From 999ad77a59f41de7e86fc962e2880c0d85512a14 Mon Sep 17 00:00:00 2001 From: loczek <30776250+loczek@users.noreply.github.com> Date: Wed, 26 Mar 2025 22:07:54 +0100 Subject: [PATCH] workspace: Double click empty pane to open new file (#27521) Release Notes: - Added ability to double click on empty pane to open a new file --- crates/workspace/src/pane.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index babd38e227..df63bdbcac 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -3315,13 +3315,28 @@ impl Render for Pane { }) .map(|div| { if let Some(item) = self.active_item() { - div.v_flex() + div.id("pane_placeholder") + .v_flex() .size_full() .overflow_hidden() .child(self.toolbar.clone()) .child(item.to_any()) } else { - let placeholder = div.h_flex().size_full().justify_center(); + let placeholder = div + .id("pane_placeholder") + .h_flex() + .size_full() + .justify_center() + .on_click(cx.listener( + move |this, event: &ClickEvent, window, cx| { + if event.up.click_count == 2 { + window.dispatch_action( + this.double_click_dispatch_action.boxed_clone(), + cx, + ); + } + }, + )); if has_worktrees { placeholder } else {