Fixed keyboard word selection when at the start/end of line, issue 14675
This commit is contained in:
parent
59ec417e4a
commit
a11a691b17
|
@ -2544,22 +2544,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;
|
||||
} else {
|
||||
while (cc > 0) {
|
||||
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
|
||||
|
||||
if (prev_char && !ischar)
|
||||
break;
|
||||
|
||||
prev_char = ischar;
|
||||
cc--;
|
||||
}
|
||||
cursor_set_column(cc);
|
||||
}
|
||||
|
||||
while (cc > 0) {
|
||||
|
||||
bool ischar = _is_text_char(text[cursor.line][cc - 1]);
|
||||
|
||||
if (prev_char && !ischar)
|
||||
break;
|
||||
|
||||
prev_char = ischar;
|
||||
cc--;
|
||||
}
|
||||
|
||||
cursor_set_column(cc);
|
||||
|
||||
} else if (cursor.column == 0) {
|
||||
|
||||
if (cursor.line > 0) {
|
||||
|
@ -2608,21 +2605,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;
|
||||
} 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++;
|
||||
}
|
||||
cursor_set_column(cc);
|
||||
}
|
||||
|
||||
while (cc < text[cursor.line].length()) {
|
||||
|
||||
bool ischar = _is_text_char(text[cursor.line][cc]);
|
||||
|
||||
if (prev_char && !ischar)
|
||||
break;
|
||||
prev_char = ischar;
|
||||
cc++;
|
||||
}
|
||||
|
||||
cursor_set_column(cc);
|
||||
|
||||
} else if (cursor.column == text[cursor.line].length()) {
|
||||
|
||||
if (cursor.line < text.size() - 1) {
|
||||
|
|
Loading…
Reference in New Issue