diff options
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r-- | scene/gui/line_edit.cpp | 61 |
1 files changed, 45 insertions, 16 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index db463c133b..49ea077a30 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -245,12 +245,26 @@ void LineEdit::_input_event(InputEvent p_event) { delete_char(); } } break; + case KEY_KP_4: { + if (k.unicode != 0) { + handled = false; + break; + } + // numlock disabled. fallthrough to key_left + } case KEY_LEFT: { shift_selection_check_pre(k.mod.shift); set_cursor_pos(get_cursor_pos()-1); shift_selection_check_post(k.mod.shift); } break; + case KEY_KP_6: { + if (k.unicode != 0) { + handled = false; + break; + } + // numlock disabled. fallthrough to key_right + } case KEY_RIGHT: { shift_selection_check_pre(k.mod.shift); @@ -271,12 +285,26 @@ void LineEdit::_input_event(InputEvent p_event) { } } break; + case KEY_KP_7: { + if (k.unicode != 0) { + handled = false; + break; + } + // numlock disabled. fallthrough to key_home + } case KEY_HOME: { shift_selection_check_pre(k.mod.shift); set_cursor_pos(0); shift_selection_check_post(k.mod.shift); } break; + case KEY_KP_1: { + if (k.unicode != 0) { + handled = false; + break; + } + // numlock disabled. fallthrough to key_end + } case KEY_END: { shift_selection_check_pre(k.mod.shift); @@ -287,26 +315,27 @@ void LineEdit::_input_event(InputEvent p_event) { default: { - if (k.unicode>=32 && k.scancode!=KEY_DELETE) { - - if (editable) { - selection_delete(); - CharType ucodestr[2]={(CharType)k.unicode,0}; - append_at_cursor(ucodestr); - emit_signal("text_changed",text); - _change_notify("text"); - } - - } else { - handled=false; - } + handled=false; } break; } - if (handled) + if (handled) { accept_event(); - else - return; + } else { + if (k.unicode>=32 && k.scancode!=KEY_DELETE) { + + if (editable) { + selection_delete(); + CharType ucodestr[2]={(CharType)k.unicode,0}; + append_at_cursor(ucodestr); + emit_signal("text_changed",text); + _change_notify("text"); + } + + } else { + return; + } + } selection.old_shift=k.mod.shift; |