diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 7a9daea73e..7b93393851 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2113,15 +2113,15 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { //keep indentation int space_count = 0; - for (int i = 0; i < text[cursor.line].length(); i++) { - if (text[cursor.line][i] == '\t' && cursor.column > 0) { + for (int i = 0; i < cursor.column; i++) { + if (text[cursor.line][i] == '\t') { if (indent_using_spaces) { ins += space_indent; } else { ins += "\t"; } space_count = 0; - } else if (text[cursor.line][i] == ' ' && cursor.column > 0) { + } else if (text[cursor.line][i] == ' ') { space_count++; if (space_count == indent_size) { |