summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2016-01-07 21:38:38 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2016-01-07 21:51:47 +0100
commita825cfd93288b4418f445cb1d8bfb4d4d2857f44 (patch)
tree24f05b1cd7e34a0fb28406dfb120394a2604308f /scene
parentb6388e60018d859856f8f837139492f6eaa2e741 (diff)
TextEdit/LineEdit: Handle numpad arrows if NumLock is disabled
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/line_edit.cpp47
-rw-r--r--scene/gui/text_edit.cpp28
2 files changed, 59 insertions, 16 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index db463c133b..917e9d331d 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);
@@ -287,26 +301,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;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 70da7e39a4..1771360c25 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1740,6 +1740,13 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
}
} break;
+ case KEY_KP_4: {
+ if (k.unicode != 0) {
+ scancode_handled = false;
+ break;
+ }
+ // numlock disabled. fallthrough to key_left
+ }
case KEY_LEFT: {
if (k.mod.shift)
@@ -1786,6 +1793,13 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
_post_shift_selection();
} break;
+ case KEY_KP_6: {
+ if (k.unicode != 0) {
+ scancode_handled = false;
+ break;
+ }
+ // numlock disabled. fallthrough to key_right
+ }
case KEY_RIGHT: {
if (k.mod.shift)
@@ -1829,6 +1843,13 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
_post_shift_selection();
} break;
+ case KEY_KP_8: {
+ if (k.unicode != 0) {
+ scancode_handled = false;
+ break;
+ }
+ // numlock disabled. fallthrough to key_up
+ }
case KEY_UP: {
if (k.mod.shift)
@@ -1849,6 +1870,13 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
_cancel_code_hint();
} break;
+ case KEY_KP_2: {
+ if (k.unicode != 0) {
+ scancode_handled = false;
+ break;
+ }
+ // numlock disabled. fallthrough to key_down
+ }
case KEY_DOWN: {
if (k.mod.shift)