diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2016-04-03 14:54:54 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2016-04-03 14:54:54 +0100 |
commit | fe779d4386ac32431ed85b6248b05f018a5db86e (patch) | |
tree | 1bd840d7c344198eae0a2e9c338d5675a4b2a526 /scene/gui | |
parent | e7572c690a3a6792e5aa183e16d902bff77398bc (diff) |
Fixed insert mode removing first unselected character
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d6575481c2..325203580e 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1625,8 +1625,10 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { k.mod.shift=false; } - // stuff to do when selection is active.. + // save here for insert mode, just in case it is cleared in the following section + bool had_selection = selection.active; + // stuff to do when selection is active.. if (selection.active) { if (readonly) @@ -2376,8 +2378,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (readonly) break; - // remove the old character if in insert mode - if (insert_mode) { + // remove the old character if in insert mode and no selection + if (insert_mode && !had_selection) { _begin_compex_operation(); // make sure we don't try and remove empty space @@ -2397,7 +2399,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { _insert_text_at_cursor(chr); } - if (insert_mode) { + if (insert_mode && !had_selection) { _end_compex_operation(); } accept_event(); |