Focus new item if pane was focused when removing previous active item

Antonio Scandurra created

Previously, we were relying on the item getting blurred and the workspace
receiving focus, which would in turn focus the active pane. This doesn't
play well with docks because they aren't part of the workspace panes.

Change summary

crates/workspace/src/pane.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

crates/workspace/src/pane.rs 🔗

@@ -903,7 +903,8 @@ impl Pane {
                 // to activating the item to the left
                 .unwrap_or_else(|| item_index.min(self.items.len()).saturating_sub(1));
 
-            self.activate_item(index_to_activate, activate_pane, activate_pane, cx);
+            let should_activate = activate_pane || self.has_focus;
+            self.activate_item(index_to_activate, should_activate, should_activate, cx);
         }
 
         let item = self.items.remove(item_index);