From f1e75527222b0e01e04c64db26e5f1e0a0017922 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Thu, 23 Jun 2016 23:03:32 +0200 Subject: Fix weird deselection behaviour with text field - TextEdit will now deselect if Ctrl+Left/Right is pressed - TextEdit and LineEdit no longer deselect text when Alt is pressed (except with Apple style keys) --- scene/gui/line_edit.cpp | 3 +++ scene/gui/text_edit.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 52ef57cf1c..88dbd33e55 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -294,6 +294,9 @@ void LineEdit::_input_event(InputEvent p_event) { } case KEY_LEFT: { +#ifndef APPLE_STYLE_KEYS + if (!k.mod.alt) +#endif shift_selection_check_pre(k.mod.shift); #ifdef APPLE_STYLE_KEYS diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9342d077eb..6fd6137ac8 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2065,6 +2065,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (k.mod.shift) _pre_shift_selection(); +#ifdef APPLE_STYLE_KEYS + else +#else + else if (!k.mod.alt) +#endif + deselect(); #ifdef APPLE_STYLE_KEYS if (k.mod.command) { @@ -2118,6 +2124,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (k.mod.shift) _pre_shift_selection(); +#ifdef APPLE_STYLE_KEYS + else +#else + else if (!k.mod.alt) +#endif + deselect(); #ifdef APPLE_STYLE_KEYS if (k.mod.command) { -- cgit v1.2.3