diff options
| author | Sherjil Ozair | 2018-04-05 12:58:15 -0400 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-06-01 17:43:10 +0200 |
| commit | 00bf66d7f2b51f0436a3a5fd31e1dd06bb6ce184 (patch) | |
| tree | 8b8f82b2e922e32b844ca25446d40f1af1a19f70 | |
| parent | 6224f02c565aba3edf7fef580e44f00ef8db72ff (diff) | |
| download | godot-00bf66d7f2b51f0436a3a5fd31e1dd06bb6ce184.tar.gz godot-00bf66d7f2b51f0436a3a5fd31e1dd06bb6ce184.tar.zst godot-00bf66d7f2b51f0436a3a5fd31e1dd06bb6ce184.zip | |
| -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 bb8a33362..e3b150795 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3005,13 +3005,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) { |
