From 2ebe16a52f9c236ff7698defaf0a24bd451bce46 Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Mon, 2 Jun 2025 21:52:35 +0530 Subject: [PATCH] workspace: Fix empty pane becomes unresponsive to keybindings after commit via terminal (#31905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #27579 This PR fixes issue where keybinding wouldn’t work in a pane after focusing it from dock using the `ActivatePaneInDirection` action in certain cases. https://github.com/user-attachments/assets/9ceca580-a63f-4807-acff-29b61819f424 Release Notes: - Fixed the issue where keybinding wouldn’t work in a pane after focusing it from dock using the `ActivatePaneInDirection` action in certain cases. --- crates/workspace/src/workspace.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index dd930e15e49702766e2d21df39950d23b84e675f..de63247f3b74f158b104c20e91c75851d71dfebc 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -3502,7 +3502,14 @@ impl Workspace { match target { Some(ActivateInDirectionTarget::Pane(pane)) => { - window.focus(&pane.focus_handle(cx)); + let pane = pane.read(cx); + if let Some(item) = pane.active_item() { + item.item_focus_handle(cx).focus(window); + } else { + log::error!( + "Could not find a focus target when in switching focus in {direction} direction for a pane", + ); + } } Some(ActivateInDirectionTarget::Dock(dock)) => { // Defer this to avoid a panic when the dock's active panel is already on the stack.