Merge pull request #28787 from mitchcurtis/fix-28059
Script Text Editor: respect Move Down and Move Up shortcuts on macOS
This commit is contained in:
commit
e6f7875e24
2 changed files with 25 additions and 0 deletions
|
@ -587,6 +587,26 @@ FindReplaceBar::FindReplaceBar() {
|
||||||
|
|
||||||
/*** CODE EDITOR ****/
|
/*** CODE EDITOR ****/
|
||||||
|
|
||||||
|
// This function should be used to handle shortcuts that could otherwise
|
||||||
|
// be handled too late if they weren't handled here.
|
||||||
|
void CodeTextEditor::_input(const Ref<InputEvent> &event) {
|
||||||
|
|
||||||
|
const Ref<InputEventKey> key_event = event;
|
||||||
|
if (!key_event.is_valid() || !key_event->is_pressed())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ED_IS_SHORTCUT("script_text_editor/move_up", key_event)) {
|
||||||
|
move_lines_up();
|
||||||
|
accept_event();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ED_IS_SHORTCUT("script_text_editor/move_down", key_event)) {
|
||||||
|
move_lines_down();
|
||||||
|
accept_event();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
@ -1375,6 +1395,9 @@ void CodeTextEditor::_notification(int p_what) {
|
||||||
warning_button->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
warning_button->set_icon(get_icon("NodeWarning", "EditorIcons"));
|
||||||
add_constant_override("separation", 4 * EDSCALE);
|
add_constant_override("separation", 4 * EDSCALE);
|
||||||
} break;
|
} break;
|
||||||
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
set_process_input(is_visible_in_tree());
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1454,6 +1477,7 @@ void CodeTextEditor::remove_all_bookmarks() {
|
||||||
|
|
||||||
void CodeTextEditor::_bind_methods() {
|
void CodeTextEditor::_bind_methods() {
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input);
|
||||||
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
|
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
|
||||||
ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed);
|
ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed);
|
||||||
ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed);
|
ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed);
|
||||||
|
|
|
@ -165,6 +165,7 @@ class CodeTextEditor : public VBoxContainer {
|
||||||
void _font_resize_timeout();
|
void _font_resize_timeout();
|
||||||
bool _add_font_size(int p_delta);
|
bool _add_font_size(int p_delta);
|
||||||
|
|
||||||
|
void _input(const Ref<InputEvent> &event);
|
||||||
void _text_editor_gui_input(const Ref<InputEvent> &p_event);
|
void _text_editor_gui_input(const Ref<InputEvent> &p_event);
|
||||||
void _zoom_in();
|
void _zoom_in();
|
||||||
void _zoom_out();
|
void _zoom_out();
|
||||||
|
|
Loading…
Reference in a new issue