Merge pull request #14983 from Paulb23/keyboard_selection_issue_14675

Fixed keyboard word selection when at the start/end of line, issue 14675
This commit is contained in:
Rémi Verschelde 2018-01-02 11:19:34 +01:00 committed by GitHub
commit d7d8fc6c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 27 deletions

View File

@ -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;
} 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) {
@ -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;
} 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) {