From f0f2a9d96083d716aa217a7ad98f6f55a1c82ae7 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 6 Jul 2022 09:24:29 +0800 Subject: [PATCH] Fix LineEdit caret after using arrow key to deselect --- scene/gui/line_edit.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index cbd05fa4d..24b6751a8 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -402,12 +402,12 @@ void LineEdit::_gui_input(Ref 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 @@ -451,11 +451,15 @@ void LineEdit::_gui_input(Ref 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