Use left/right arrow to move cursor when unselecting in LineEdit
-- useful for rename dialog (the filename portion is selected by default, and usually, want to change the end of the name, not the beginning)
This commit is contained in:
parent
cedf9f68b1
commit
ee39093ce3
1 changed files with 24 additions and 3 deletions
|
@ -358,11 +358,20 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
}
|
}
|
||||||
case KEY_LEFT: {
|
case KEY_LEFT: {
|
||||||
|
|
||||||
#ifndef APPLE_STYLE_KEYS
|
#ifndef APPLE_STYLE_KEYS
|
||||||
if (!k->get_alt())
|
if (!k->get_alt()) {
|
||||||
#endif
|
#endif
|
||||||
|
if (selection.enabled && !k->get_shift()) {
|
||||||
|
set_cursor_position(selection.begin);
|
||||||
|
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
|
#ifdef APPLE_STYLE_KEYS
|
||||||
if (k->get_command()) {
|
if (k->get_command()) {
|
||||||
|
@ -405,8 +414,20 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
}
|
}
|
||||||
case KEY_RIGHT: {
|
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
|
#ifdef APPLE_STYLE_KEYS
|
||||||
if (k->get_command()) {
|
if (k->get_command()) {
|
||||||
|
|
Loading…
Reference in a new issue