diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-02 11:19:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-02 11:19:34 +0100 |
commit | d7d8fc6c207c80896a3da7dbdbb35d57df4bcb86 (patch) | |
tree | 0c3a3f83b82a4c8694d4c76cef5af99f6d1baeb3 /scene | |
parent | c9005ca7fd63980eaf09ebe4598521aa1083873b (diff) | |
parent | a11a691b174c0ddb72328cf8dae6d6f82f5ad885 (diff) |
Merge pull request #14983 from Paulb23/keyboard_selection_issue_14675
Fixed keyboard word selection when at the start/end of line, issue 14675
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 46ad956b68..2ce31ea1b3 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2581,22 +2581,19 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (cc == 0 && cursor.line > 0) { cursor_set_line(cursor.line - 1); cursor_set_column(text[cursor.line].length()); - break; - } - - while (cc > 0) { - - bool ischar = _is_text_char(text[cursor.line][cc - 1]); + } else { + while (cc > 0) { + bool ischar = _is_text_char(text[cursor.line][cc - 1]); - if (prev_char && !ischar) - break; + if (prev_char && !ischar) + break; - prev_char = ischar; - cc--; + prev_char = ischar; + cc--; + } + cursor_set_column(cc); } - cursor_set_column(cc); - } else if (cursor.column == 0) { if (cursor.line > 0) { @@ -2645,21 +2642,18 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (cc == text[cursor.line].length() && cursor.line < text.size() - 1) { cursor_set_line(cursor.line + 1); cursor_set_column(0); - break; - } - - while (cc < text[cursor.line].length()) { - - bool ischar = _is_text_char(text[cursor.line][cc]); + } else { + while (cc < text[cursor.line].length()) { + bool ischar = _is_text_char(text[cursor.line][cc]); - if (prev_char && !ischar) - break; - prev_char = ischar; - cc++; + if (prev_char && !ischar) + break; + prev_char = ischar; + cc++; + } + cursor_set_column(cc); } - cursor_set_column(cc); - } else if (cursor.column == text[cursor.line].length()) { if (cursor.line < text.size() - 1) { |