Merge pull request #36050 from eswartz/line-edit-move-cursor-on-unselect

Use left/right arrow to move cursor when unselecting in LineEdit
This commit is contained in:
Rémi Verschelde 2020-02-27 14:04:19 +01:00 committed by GitHub
commit d94155e10b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -358,11 +358,20 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
[[fallthrough]];
}
case KEY_LEFT: {
#ifndef APPLE_STYLE_KEYS
if (!k->get_alt())
if (!k->get_alt()) {
#endif
if (selection.enabled && !k->get_shift()) {
set_cursor_position(selection.begin);
deselect();
handled = true;
break;
}
shift_selection_check_pre(k->get_shift());
#ifndef APPLE_STYLE_KEYS
}
#endif
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {
@ -405,8 +414,20 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
[[fallthrough]];
}
case KEY_RIGHT: {
#ifndef APPLE_STYLE_KEYS
if (!k->get_alt()) {
#endif
if (selection.enabled && !k->get_shift()) {
set_cursor_position(selection.end);
deselect();
handled = true;
break;
}
shift_selection_check_pre(k->get_shift());
shift_selection_check_pre(k->get_shift());
#ifndef APPLE_STYLE_KEYS
}
#endif
#ifdef APPLE_STYLE_KEYS
if (k->get_command()) {