Merge pull request #62761 from timothyqiu/line-edit-move

[3.x] Fix LineEdit caret after using arrow key to deselect
This commit is contained in:
Rémi Verschelde 2022-07-06 08:03:50 +02:00 committed by GitHub
commit 0902165492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -426,12 +426,12 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (!k->get_alt())
#endif
{
shift_selection_check_pre(k->get_shift());
if (selection.enabled && !k->get_shift()) {
set_cursor_position(selection.begin);
deselect();
break;
}
shift_selection_check_pre(k->get_shift());
}
#ifdef APPLE_STYLE_KEYS
@ -475,11 +475,15 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
FALLTHROUGH;
}
case KEY_RIGHT: {
if (selection.enabled && !k->get_shift()) {
set_cursor_position(selection.end);
deselect();
break;
} else {
#ifndef APPLE_STYLE_KEYS
if (!k->get_alt())
#endif
{
if (selection.enabled && !k->get_shift()) {
set_cursor_position(selection.end);
deselect();
break;
}
shift_selection_check_pre(k->get_shift());
}
#ifdef APPLE_STYLE_KEYS