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.

Wire up the middle mouse button to close tabs (#3714)

Marshall Bowers3e6b84a726d2
diff --git a/crates/workspace2/src/pane.rs b/crates/workspace2/src/pane.rs
index 65e34c9fa5c..e1bb006c114 100644
--- a/crates/workspace2/src/pane.rs
+++ b/crates/workspace2/src/pane.rs
@@ -1493,6 +1493,14 @@ impl Pane {
.on_click(
cx.listener(move |pane: &mut Self, _, cx| pane.activate_item(ix, true, true, cx)),
)
+ // TODO: This should be a click listener with the middle mouse button instead of a mouse down listener.
+ .on_mouse_down(
+ MouseButton::Middle,
+ cx.listener(move |pane, _event, cx| {
+ pane.close_item_by_id(item_id, SaveIntent::Close, cx)
+ .detach_and_log_err(cx);
+ }),
+ )
.on_drag(
DraggedTab {
pane: cx.view().clone(),