diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-05-07 15:59:22 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 15:59:22 -0300 |
commit | dff3a2f3789ee2fb7eebb1d115097b944b439a18 (patch) | |
tree | f7f6bd56b64206fd847699ddb89cae4af6fcc9e8 /scene/gui | |
parent | 8b9b653e763d94e56b2c4968fc2df4dbf8060943 (diff) | |
parent | 166c7fdc9d42c8155e186defa44e224600d96bf8 (diff) |
Merge pull request #18003 from sherjilozair/patch_macosx_shortcuts
Add additional macos shortcuts for going to start/end of line
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/text_edit.cpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d451a6536e..d7f0c16d78 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2843,13 +2843,64 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { } break; case KEY_A: { +#ifndef APPLE_STYLE_KEYS if (!k->get_command() || k->get_shift() || k->get_alt()) { scancode_handled = false; break; } - select_all(); +#else + if (k->get_alt()) { + scancode_handled = false; + break; + } + if (!k->get_shift() && k->get_command()) + select_all(); + else if (k->get_control()) { + if (k->get_shift()) + _pre_shift_selection(); + + int current_line_whitespace_len = 0; + while (current_line_whitespace_len < text[cursor.line].length()) { + CharType c = text[cursor.line][current_line_whitespace_len]; + if (c != '\t' && c != ' ') + break; + current_line_whitespace_len++; + } + + if (cursor_get_column() == current_line_whitespace_len) + cursor_set_column(0); + else + cursor_set_column(current_line_whitespace_len); + + if (k->get_shift()) + _post_shift_selection(); + else if (k->get_command() || k->get_control()) + deselect(); + } + } break; + case KEY_E: { + + if (!k->get_control() || k->get_command() || k->get_alt()) { + scancode_handled = false; + break; + } + if (k->get_shift()) + _pre_shift_selection(); + + if (k->get_command()) + cursor_set_line(text.size() - 1, true, false); + cursor_set_column(text[cursor.line].length()); + + if (k->get_shift()) + _post_shift_selection(); + else if (k->get_command() || k->get_control()) + deselect(); + + _cancel_completion(); + completion_hint = ""; +#endif } break; case KEY_X: { if (readonly) { |