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.

project_panel: Open files in a permanent tab on middle click (#60563)

Vlad Roskova3a4719a8a24
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 8b830513b2c..8b23423a973 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -6015,6 +6015,16 @@ impl ProjectPanel {
}
}),
)
+ .on_aux_click(
+ cx.listener(move |project_panel, event: &gpui::ClickEvent, _, cx| {
+ if !event.is_middle_click() || show_editor || !kind.is_file() {
+ return;
+ }
+
+ project_panel.open_entry(entry_id, true, false, cx);
+ cx.stop_propagation();
+ }),
+ )
.child(
ListItem::new(id)
.indent_level(depth)
diff --git a/docs/src/project-panel.md b/docs/src/project-panel.md
index afee88bbf36..030177af8f6 100644
--- a/docs/src/project-panel.md
+++ b/docs/src/project-panel.md
@@ -21,6 +21,8 @@ project_panel::CollapseAllEntries} collapses every directory at once. {#kb
project_panel::ExpandAllEntries} expands every directory at once. Press {#kb
project_panel::Open} or click to preview a selected file, without giving it a
permanent tab. Editing the file or double-clicking it promotes it to a permanent tab.
+Middle-clicking a file skips the preview and opens it in a permanent, focused tab
+right away.
### Auto-reveal