diff options
-rw-r--r-- | editor/code_editor.cpp | 15 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 2 | ||||
-rw-r--r-- | modules/mono/csharp_script.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 17 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 |
5 files changed, 33 insertions, 4 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 4c7f2f53cc..19bcb28fa5 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -677,7 +677,20 @@ void CodeTextEditor::_reset_zoom() { void CodeTextEditor::_line_col_changed() { line_nb->set_text(itos(text_editor->cursor_get_line() + 1)); - col_nb->set_text(itos(text_editor->cursor_get_column() + 1)); + + String line = text_editor->get_line(text_editor->cursor_get_line()); + + int positional_column = 0; + + for (int i = 0; i < text_editor->cursor_get_column(); i++) { + if (line[i] == '\t') { + positional_column += text_editor->get_indent_size(); //tab size + } else { + positional_column += 1; + } + } + + col_nb->set_text(itos(positional_column + 1)); } void CodeTextEditor::_text_changed() { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index b38b30d4b8..87e1276492 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -61,7 +61,7 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str "# var b = \"textvar\"\n\n" + "func _ready():\n" + "%TS%# Called when the node is added to the scene for the first time.\n" + - "%TS%# Initialization here\n" + + "%TS%# Initialization here.\n" + "%TS%pass\n\n" + "#func _process(delta):\n" + "#%TS%# Called every frame. Delta is time since last frame.\n" + diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index adc5f16f92..bbe245951e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -305,7 +305,7 @@ Ref<Script> CSharpLanguage::get_template(const String &p_class_name, const Strin " public override void _Ready()\n" " {\n" " // Called every time the node is added to the scene.\n" - " // Initialization here\n" + " // Initialization here.\n" " \n" " }\n" "\n" diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 24a13db3c3..d451a6536e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2410,6 +2410,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { cursor_set_line(line); cursor_set_column(column); +#ifdef APPLE_STYLE_KEYS + } else if (k->get_command()) { + int cursor_current_column = cursor.column; + cursor.column = 0; + _remove_text(cursor.line, 0, cursor.line, cursor_current_column); +#endif } else { if (cursor.line > 0 && is_line_hidden(cursor.line - 1)) unfold_line(cursor.line - 1); @@ -2684,7 +2690,11 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { next_line = line; next_column = column; - +#ifdef APPLE_STYLE_KEYS + } else if (k->get_command()) { + next_column = curline_len; + next_line = cursor.line; +#endif } else { next_column = cursor.column < curline_len ? (cursor.column + 1) : 0; } @@ -4978,6 +4988,11 @@ void TextEdit::set_indent_size(const int p_size) { update(); } +int TextEdit::get_indent_size() { + + return indent_size; +} + void TextEdit::set_draw_tabs(bool p_draw) { draw_tabs = p_draw; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 30e70bfd0b..60c6ab4929 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -557,6 +557,7 @@ public: void set_indent_using_spaces(const bool p_use_spaces); bool is_indent_using_spaces() const; void set_indent_size(const int p_size); + int get_indent_size(); void set_draw_tabs(bool p_draw); bool is_drawing_tabs() const; void set_override_selected_font_color(bool p_override_selected_font_color); |