workspace: Fix empty pane becomes unresponsive to keybindings after commit via terminal (#31905)

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.
This commit is contained in:
Smit Barmase 2025-06-02 21:52:35 +05:30 committed by GitHub
parent 1ed4647203
commit 2ebe16a52f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.