Преглед изворни кода

Adds support for CMD+Left and CMD+Right on MacOS

CMD+Left and CMD+Right are hotkeys used on MacOS for
moving cursor to start and end of the text, respectively.
They are now supported, alongside ALT+key.

Fixes: #17631
Anish пре 7 година
родитељ
комит
a126876cc8
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      scene/gui/line_edit.cpp

+ 6 - 0
scene/gui/line_edit.cpp

@@ -215,6 +215,12 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
 				case (KEY_A): { //Select All
 					select();
 				} break;
+				case (KEY_LEFT): { // Go to start of text - like HOME key
+					set_cursor_position(0);
+				} break;
+				case (KEY_RIGHT): { // Go to end of text - like END key
+					set_cursor_position(text.length());
+				} break;
 				default: { handled = false; }
 			}