diff options
author | Paulo Gomes <tuga3d@gmail.com> | 2017-08-26 15:46:46 +0100 |
---|---|---|
committer | Paulo Gomes <tuga3d@gmail.com> | 2017-08-26 19:22:05 +0100 |
commit | 056b0976bc914d2f4a1f99fe8308f38283f2aadc (patch) | |
tree | 23d15cc62351a3aff66962858a4f49176a45f854 /scene/gui | |
parent | dd7145b778ea4884fd52f5efaf79dc55375c8465 (diff) |
Added a cursor column check.
Fixes glich, when cursor is on column 0 of and indented line and you
press return an extra indent is added.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2c50b4e854..e506953d77 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2115,14 +2115,14 @@ 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') { + if (text[cursor.line][i] == '\t' && cursor.column > 0) { if (indent_using_spaces) { ins += space_indent; } else { ins += "\t"; } space_count = 0; - } else if (text[cursor.line][i] == ' ') { + } else if (text[cursor.line][i] == ' ' && cursor.column > 0) { space_count++; if (space_count == indent_size) { |