diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-08-18 20:53:03 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-08-18 20:53:27 +0200 |
commit | 3f2d806b02b222b8678783541523d6d3417fee25 (patch) | |
tree | 9b723b04f3033ceaa695c0d949f068d89f7a6ac1 | |
parent | 72be8876ea40984532d283c598dfcc267d30c829 (diff) |
TextEdit: Moving between words now works across lines.
Fixes #10403
-rw-r--r-- | scene/gui/text_edit.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2b47539c42..324c0cd0d1 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2248,6 +2248,13 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { #endif bool prev_char = false; int cc = cursor.column; + + 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]); @@ -2305,6 +2312,13 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { #endif bool prev_char = false; int cc = cursor.column; + + 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]); |