diff options
| author | Paulb23 | 2016-04-03 15:21:16 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2016-04-06 18:46:36 +0200 |
| commit | 48438e4f3b2e2fe190b11ee3dd426a0e072b70ff (patch) | |
| tree | f10e4db78b89695401af3b4c6464770eb66be5be | |
| parent | 5f901e2b27c57a218ae743171068f90e176fb132 (diff) | |
| download | godot-48438e4f3b2e2fe190b11ee3dd426a0e072b70ff.tar.gz godot-48438e4f3b2e2fe190b11ee3dd426a0e072b70ff.tar.zst godot-48438e4f3b2e2fe190b11ee3dd426a0e072b70ff.zip | |
Fixed insert mode interaction with auto complete
(cherry picked from commit a984adb5a6bde78c3b3c7681ad529cf22f2452ec)
| -rw-r--r-- | scene/gui/text_edit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 24269eb51..6f17ce036 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1596,7 +1596,22 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { 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_compex_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); + } + } + _insert_text_at_cursor(chr); + + if (insert_mode) { + _end_compex_operation(); + } } } |
