summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authormegalike <megalike@gmail.com>2019-05-04 17:05:49 +0300
committermegalike <megalike@gmail.com>2019-05-04 17:15:32 +0300
commitc6310e9a7e11067b4a0a49e11f93b11e60f97675 (patch)
tree4890ab84a9272b6c63073a3188d267534e0382bc /scene/gui
parent84401e8cdf4f41fc0e804bf5410622e75a08c0f5 (diff)
Support Mac OS default delete char hotkeys
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/text_edit.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index ec714dc8a3..10bd9e2a8b 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2277,24 +2277,30 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
}
#ifdef APPLE_STYLE_KEYS
if (k->get_control() && !k->get_shift() && !k->get_alt() && !k->get_command()) {
- uint32_t move_cursor_key = KEY_UNKNOWN;
+ uint32_t remap_key = KEY_UNKNOWN;
switch (k->get_scancode()) {
case KEY_F: {
- move_cursor_key = KEY_RIGHT;
+ remap_key = KEY_RIGHT;
} break;
case KEY_B: {
- move_cursor_key = KEY_LEFT;
+ remap_key = KEY_LEFT;
} break;
case KEY_P: {
- move_cursor_key = KEY_UP;
+ remap_key = KEY_UP;
} break;
case KEY_N: {
- move_cursor_key = KEY_DOWN;
+ remap_key = KEY_DOWN;
+ } break;
+ case KEY_D: {
+ remap_key = KEY_DELETE;
+ } break;
+ case KEY_H: {
+ remap_key = KEY_BACKSPACE;
} break;
}
- if (move_cursor_key != KEY_UNKNOWN) {
- k->set_scancode(move_cursor_key);
+ if (remap_key != KEY_UNKNOWN) {
+ k->set_scancode(remap_key);
k->set_control(false);
}
}