summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-27 14:04:19 +0100
committerGitHub <noreply@github.com>2020-02-27 14:04:19 +0100
commitd94155e10bfa7a822f85b2ea176918e8377e3363 (patch)
tree92bed19ffe6abc50baf3ec1172f0df7d8227a8e7 /scene
parente437bcbccf0df046a67685e840e9c2d98a6e3c03 (diff)
parentee39093ce3b1c54ec2397788307895c7c76ded91 (diff)
Merge pull request #36050 from eswartz/line-edit-move-cursor-on-unselect
Use left/right arrow to move cursor when unselecting in LineEdit
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/line_edit.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 0d3ab36852..fb8396e4ff 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -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()) {