Merge pull request #28679 from megalike/fix_mac_os_delete_char_hotkeys
Support Mac OS default delete char hotkeys
This commit is contained in:
commit
1a3a0e3d95
1 changed files with 13 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue