diff options
| author | Paulb23 | 2016-05-05 16:27:05 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-05-12 09:03:59 +0200 |
| commit | abc97d3bb42aa04c2fd20c330b6a71f8c9755353 (patch) | |
| tree | a2136fec06e4226264e4255f61faa5d8c5a4038c /scene/gui/text_edit.cpp | |
| parent | a5e54b83ec716eef424c2db8ad563d62d410d8b6 (diff) | |
| download | godot-abc97d3bb42aa04c2fd20c330b6a71f8c9755353.tar.gz godot-abc97d3bb42aa04c2fd20c330b6a71f8c9755353.tar.zst godot-abc97d3bb42aa04c2fd20c330b6a71f8c9755353.zip | |
Fixed autocomplete truncate, issue 4554
(cherry picked from commit accc2a195bdcb79628650a61e6d9a3e408c37d19)
Diffstat (limited to 'scene/gui/text_edit.cpp')
| -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 8509c24df..41700f462 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1644,35 +1644,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(); |
