workspace: Fix empty pane becomes unresponsive to keybindings after commit via terminal (#31905)
Smit Barmase
created
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.
@@ -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.