Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add support for closing window tabs with middle mouse click (#41628)

Abdugani Toshmukhamedov7aacc7566c6b
diff --git a/crates/title_bar/src/system_window_tabs.rs b/crates/title_bar/src/system_window_tabs.rs
index ba898da716f..a9bf46cc4f9 100644
--- a/crates/title_bar/src/system_window_tabs.rs
+++ b/crates/title_bar/src/system_window_tabs.rs
@@ -227,6 +227,15 @@ impl SystemWindowTabs {
window.activate_window();
});
})
+ .on_mouse_up(MouseButton::Middle, move |_, window, cx| {
+ if item.handle.window_id() == window.window_handle().window_id() {
+ window.dispatch_action(Box::new(CloseWindow), cx);
+ } else {
+ let _ = item.handle.update(cx, |_, window, cx| {
+ window.dispatch_action(Box::new(CloseWindow), cx);
+ });
+ }
+ })
.child(label)
.map(|this| match show_close_button {
ShowCloseButton::Hidden => this,