Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

pane: 'Close others' now closes relative to right-clicked tab (#34355)

vipex00ec24377101
diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs
index a77112213f1..3aa86a434da 100644
--- a/crates/collab/src/tests/following_tests.rs
+++ b/crates/collab/src/tests/following_tests.rs
@@ -1013,7 +1013,7 @@ async fn test_peers_following_each_other(cx_a: &mut TestAppContext, cx_b: &mut T
// and some of which were originally opened by client B.
workspace_b.update_in(cx_b, |workspace, window, cx| {
workspace.active_pane().update(cx, |pane, cx| {
- pane.close_inactive_items(&Default::default(), window, cx)
+ pane.close_inactive_items(&Default::default(), None, window, cx)
.detach();
});
});
diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs
index b9078301c77..0d61f2f8586 100644
--- a/crates/editor/src/editor_tests.rs
+++ b/crates/editor/src/editor_tests.rs
@@ -21465,7 +21465,7 @@ println!("5");
.unwrap();
pane_1
.update_in(cx, |pane, window, cx| {
- pane.close_inactive_items(&CloseInactiveItems::default(), window, cx)
+ pane.close_inactive_items(&CloseInactiveItems::default(), None, window, cx)
})
.await
.unwrap();
@@ -21501,7 +21501,7 @@ println!("5");
.unwrap();
pane_2
.update_in(cx, |pane, window, cx| {
- pane.close_inactive_items(&CloseInactiveItems::default(), window, cx)
+ pane.close_inactive_items(&CloseInactiveItems::default(), None, window, cx)
})
.await
.unwrap();
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs
index 56db7fa5700..233d435f4b3 100644
--- a/crates/workspace/src/pane.rs
+++ b/crates/workspace/src/pane.rs
@@ -1346,6 +1346,7 @@ impl Pane {
pub fn close_inactive_items(
&mut self,
action: &CloseInactiveItems,
+ target_item_id: Option<EntityId>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Task<Result<()>> {
@@ -1353,7 +1354,11 @@ impl Pane {
return Task::ready(Ok(()));
}
- let active_item_id = self.active_item_id();
+ let active_item_id = match target_item_id {
+ Some(result) => result,
+ None => self.active_item_id(),
+ };
+
let pinned_item_ids = self.pinned_item_ids();
self.close_items(
@@ -2596,6 +2601,7 @@ impl Pane {
.handler(window.handler_for(&pane, move |pane, window, cx| {
pane.close_inactive_items(
&close_inactive_items_action,
+ Some(item_id),
window,
cx,
)
@@ -3505,7 +3511,7 @@ impl Render for Pane {
)
.on_action(
cx.listener(|pane: &mut Self, action: &CloseInactiveItems, window, cx| {
- pane.close_inactive_items(action, window, cx)
+ pane.close_inactive_items(action, None, window, cx)
.detach_and_log_err(cx);
}),
)
@@ -5841,6 +5847,7 @@ mod tests {
save_intent: None,
close_pinned: false,
},
+ None,
window,
cx,
)
@@ -6206,6 +6213,7 @@ mod tests {
save_intent: None,
close_pinned: false,
},
+ None,
window,
cx,
)
diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs
index 125b5bb98a7..99ab3cf6b71 100644
--- a/crates/workspace/src/workspace.rs
+++ b/crates/workspace/src/workspace.rs
@@ -2777,6 +2777,7 @@ impl Workspace {
save_intent: None,
close_pinned: false,
},
+ None,
window,
cx,
)
@@ -9452,6 +9453,7 @@ mod tests {
save_intent: Some(SaveIntent::Save),
close_pinned: true,
},
+ None,
window,
cx,
)