From 2ab7a6feb014c566c10f40d295e0691f7ad189bd Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Fri, 18 Aug 2017 20:53:03 +0200 Subject: [PATCH] TextEdit: Moving between words now works across lines. Fixes #10403 (cherry picked from commit 3f2d806b02b222b8678783541523d6d3417fee25) --- scene/gui/text_edit.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 495d7cc3257..585b7ced23b 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -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]);