TextEdit: Moving between words now works across lines.

Fixes #10403

(cherry picked from commit 3f2d806b02)
This commit is contained in:
Andreas Haas 2017-08-18 20:53:03 +02:00 committed by Rémi Verschelde
parent f6575f8d9a
commit 2ab7a6feb0

View file

@ -2037,6 +2037,13 @@ void TextEdit::_input_event(const InputEvent &p_input_event) {
#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]);
@ -2094,6 +2101,13 @@ void TextEdit::_input_event(const InputEvent &p_input_event) {
#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]);