diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index e0149213647..37ddb2bc411 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -88,6 +88,7 @@ const char *GDFunctions::get_func_name(Function p_func) { "str", "print", "printt", + "prints", "printerr", "printraw", "var2str", @@ -561,6 +562,22 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret=Variant(); + } break; + case TEXT_PRINT_SPACED: { + + String str; + for(int i=0;ioperator String(); + } + + //str+="\n"; + print_line(str); + r_ret=Variant(); + + } break; case TEXT_PRINTERR: { @@ -1251,6 +1268,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type=Variant::NIL; return mi; + } break; + case TEXT_PRINT_SPACED: { + + MethodInfo mi("prints",PropertyInfo(Variant::NIL,"what"),PropertyInfo(Variant::NIL,"...")); + mi.return_val.type=Variant::NIL; + return mi; + } break; case TEXT_PRINTERR: { diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index ecd7d158be0..ad35a628d54 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h @@ -84,6 +84,7 @@ public: TEXT_STR, TEXT_PRINT, TEXT_PRINT_TABBED, + TEXT_PRINT_SPACED, TEXT_PRINTERR, TEXT_PRINTRAW, VAR_TO_STR, diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 56b283aa32c..0745baafe64 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -1036,7 +1036,7 @@ void GDTokenizerText::advance(int p_amount) { ////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BYTECODE_VERSION 3 +#define BYTECODE_VERSION 4 Error GDTokenizerBuffer::set_code_buffer(const Vector & p_buffer) { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 3489b025983..6b2e5aea787 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -235,6 +235,9 @@ if (m_height > line_height) {\ while (c[end]!=0 && !(end && c[end-1]==' ' && c[end]!=' ')) { int cw = font->get_char_size(c[end],c[end+1]).width; + if (c[end]=='\t') { + cw=tab_size*font->get_char_size(' ').width; + } w+=cw; if (c[end]==' ') { @@ -292,6 +295,9 @@ if (m_height > line_height) {\ int cw=font->get_char_size(c[i],c[i+1]).x; + if (c[i]=='\t') { + cw=tab_size*font->get_char_size(' ').width; + } if (p_click_pos.x-cw/2>pofs) { @@ -332,6 +338,10 @@ if (m_height > line_height) {\ cw=font->draw_char(ci,Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); } + if (c[i]=='\t') { + cw=tab_size*font->get_char_size(' ').width; + } + //print_line("draw char: "+String::chr(c[i]));