summaryrefslogtreecommitdiff
path: root/scene/gui/line_edit.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-01-07 23:11:05 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-01-07 23:11:05 +0100
commit79c1392d17156aeb8d6a2abca16db59b1f8312cc (patch)
treedc7dc2f6d9240307d607f0ceb9cc79f2daf42acb /scene/gui/line_edit.cpp
parent20e395def61cc027509e9d56152cfc40ec9621ee (diff)
parent6541f6418e5b1f1f3a35a010dcb04bd04f5b4e6f (diff)
Merge pull request #3269 from neikeq/numpad_arrows
TextEdit/LineEdit: Handle numpad when NumLock is disabled
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r--scene/gui/line_edit.cpp61
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;