Skip to content

Commit d867f11

Browse files
committed
Allow middle-click to close scripts
Fixes godotengine#20871
1 parent b293dd3 commit d867f11

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

editor/plugins/script_editor_plugin.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,9 +2384,23 @@ void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
23842384
void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
23852385

23862386
Ref<InputEventMouseButton> mb = ev;
2387-
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
2387+
if (mb.is_valid() && mb->is_pressed()) {
2388+
switch (mb->get_button_index()) {
2389+
2390+
case BUTTON_MIDDLE: {
2391+
// Right-click selects automatically; middle-click does not.
2392+
int idx = script_list->get_item_at_position(mb->get_position(), true);
2393+
if (idx >= 0) {
2394+
script_list->select(idx);
2395+
_script_selected(idx);
2396+
_menu_option(FILE_CLOSE);
2397+
}
2398+
} break;
23882399

2389-
_make_script_list_context_menu();
2400+
case BUTTON_RIGHT: {
2401+
_make_script_list_context_menu();
2402+
} break;
2403+
}
23902404
}
23912405
}
23922406

0 commit comments

Comments
 (0)