mirror of
https://github.com/godotengine/godot.git
synced 2025-01-24 11:32:51 -05:00
[macOS] Command-backspace in line edit
Make command-backspace in line edit work like other macOS applications. If there is a selection, command-backspace deletes the selection. If there isn't a selection, command-backspace deletes from the cursor to the beginning of the line edit. This addresses part of godotengine/godot#23548
This commit is contained in:
parent
4e0f31a67c
commit
7433c9d40c
1 changed files with 16 additions and 0 deletions
|
@ -274,6 +274,22 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
|||
set_cursor_position(text.length());
|
||||
shift_selection_check_post(k->get_shift());
|
||||
} break;
|
||||
case (KEY_BACKSPACE): {
|
||||
if (!editable)
|
||||
break;
|
||||
|
||||
// If selected, delete the selection
|
||||
if (selection.enabled) {
|
||||
selection_delete();
|
||||
break;
|
||||
}
|
||||
|
||||
// Otherwise delete from cursor to beginning of text edit
|
||||
int current_pos = get_cursor_position();
|
||||
if (current_pos != 0) {
|
||||
delete_text(0, current_pos);
|
||||
}
|
||||
} break;
|
||||
#endif
|
||||
default: {
|
||||
handled = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue