diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-05-07 20:19:40 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-05-07 20:19:40 +0200 |
commit | 59e68ae6d02c87c5130eb4aea6de3dc936f223bb (patch) | |
tree | 39eee62dd7ef82a3e85fd4038f130b31eebba709 /scene/gui | |
parent | 21a71e8b7c6d518aaa444dd559e286dceaeaf1bd (diff) | |
parent | accc2a195bdcb79628650a61e6d9a3e408c37d19 (diff) |
Merge pull request #4557 from Paulb23/autocomplete_truncate_issue_4554
Fixed autocomplete truncate, issue 4554
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ef29d25aa6..a8a3cb5537 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1659,35 +1659,27 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (k.unicode>32) { - if (cursor.column<text[cursor.line].length() && text[cursor.line][cursor.column]==k.unicode) { - //same char, move ahead - cursor_set_column(cursor.column+1); - + const CharType chr[2] = {(CharType)k.unicode, 0}; + if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { + _consume_pair_symbol(chr[0]); } else { - //different char, go back - const CharType chr[2] = {(CharType)k.unicode, 0}; - if(auto_brace_completion_enabled && _is_pair_symbol(chr[0])) { - _consume_pair_symbol(chr[0]); - } else { - // remove the old character if in insert mode - if (insert_mode) { - begin_complex_operation(); + // remove the old character if in insert mode + if (insert_mode) { + begin_complex_operation(); - // make sure we don't try and remove empty space - if (cursor.column < get_line(cursor.line).length()) { - _remove_text(cursor.line, cursor.column, cursor.line, cursor.column + 1); - } + // make sure we don't try and remove empty space + if (cursor.column < get_line(cursor.line).length()) { + _remove_text(cursor.line, cursor.column, cursor.line, cursor.column + 1); } + } - _insert_text_at_cursor(chr); + _insert_text_at_cursor(chr); - if (insert_mode) { - end_complex_operation(); - } + if (insert_mode) { + end_complex_operation(); } } - _update_completion_candidates(); accept_event(); |