From c287397a18e3f1385d634daf00f88776ca688533 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 17 Jul 2025 21:40:02 -0300 Subject: [PATCH] Rename "CloseInactiveItems" action to "CloseOtherItems" (#34676) This is following feedback from folks that were searching the "close others" action, available in the tab's context menu, and not finding it because it was actually named "close inactive", which was confusing. So, this PR makes sure the tab's menu item and the action have consistent naming. Release Notes: - Rename "CloseInactiveItems" action to "CloseOtherItems" for naming consistency. --- assets/keymaps/default-linux.json | 2 +- assets/keymaps/default-macos.json | 2 +- assets/keymaps/linux/emacs.json | 2 +- assets/keymaps/macos/emacs.json | 2 +- crates/collab/src/tests/following_tests.rs | 2 +- crates/editor/src/editor_tests.rs | 6 ++--- crates/vim/src/command.rs | 4 ++-- crates/workspace/src/pane.rs | 27 +++++++++++----------- crates/workspace/src/workspace.rs | 8 +++---- 9 files changed, 28 insertions(+), 27 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index ebc88ec135e53d6fee8ff3668f400d34f993abe9..b859d2d84c98f721c51f37302a7123a222796dfa 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -419,7 +419,7 @@ "ctrl-shift-pagedown": "pane::SwapItemRight", "ctrl-f4": ["pane::CloseActiveItem", { "close_pinned": false }], "ctrl-w": ["pane::CloseActiveItem", { "close_pinned": false }], - "alt-ctrl-t": ["pane::CloseInactiveItems", { "close_pinned": false }], + "alt-ctrl-t": ["pane::CloseOtherItems", { "close_pinned": false }], "alt-ctrl-shift-w": "workspace::CloseInactiveTabsAndPanes", "ctrl-k e": ["pane::CloseItemsToTheLeft", { "close_pinned": false }], "ctrl-k t": ["pane::CloseItemsToTheRight", { "close_pinned": false }], diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index cec485ce883d43404acfe62f7974ff3759cad207..748deaa05d5be88c9a1e4f79d6b4eb03dedbd028 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -477,7 +477,7 @@ "ctrl-shift-pageup": "pane::SwapItemLeft", "ctrl-shift-pagedown": "pane::SwapItemRight", "cmd-w": ["pane::CloseActiveItem", { "close_pinned": false }], - "alt-cmd-t": ["pane::CloseInactiveItems", { "close_pinned": false }], + "alt-cmd-t": ["pane::CloseOtherItems", { "close_pinned": false }], "ctrl-alt-cmd-w": "workspace::CloseInactiveTabsAndPanes", "cmd-k e": ["pane::CloseItemsToTheLeft", { "close_pinned": false }], "cmd-k t": ["pane::CloseItemsToTheRight", { "close_pinned": false }], diff --git a/assets/keymaps/linux/emacs.json b/assets/keymaps/linux/emacs.json index 0c633efabee89e5756b36e2ea5e5f31d02a5819d..0ff3796f03d85affdae88d009e88e73516ba385a 100755 --- a/assets/keymaps/linux/emacs.json +++ b/assets/keymaps/linux/emacs.json @@ -114,7 +114,7 @@ "ctrl-x o": "workspace::ActivateNextPane", // other-window "ctrl-x k": "pane::CloseActiveItem", // kill-buffer "ctrl-x 0": "pane::CloseActiveItem", // delete-window - "ctrl-x 1": "pane::CloseInactiveItems", // delete-other-windows + "ctrl-x 1": "pane::CloseOtherItems", // delete-other-windows "ctrl-x 2": "pane::SplitDown", // split-window-below "ctrl-x 3": "pane::SplitRight", // split-window-right "ctrl-x ctrl-f": "file_finder::Toggle", // find-file diff --git a/assets/keymaps/macos/emacs.json b/assets/keymaps/macos/emacs.json index 0c633efabee89e5756b36e2ea5e5f31d02a5819d..0ff3796f03d85affdae88d009e88e73516ba385a 100755 --- a/assets/keymaps/macos/emacs.json +++ b/assets/keymaps/macos/emacs.json @@ -114,7 +114,7 @@ "ctrl-x o": "workspace::ActivateNextPane", // other-window "ctrl-x k": "pane::CloseActiveItem", // kill-buffer "ctrl-x 0": "pane::CloseActiveItem", // delete-window - "ctrl-x 1": "pane::CloseInactiveItems", // delete-other-windows + "ctrl-x 1": "pane::CloseOtherItems", // delete-other-windows "ctrl-x 2": "pane::SplitDown", // split-window-below "ctrl-x 3": "pane::SplitRight", // split-window-right "ctrl-x ctrl-f": "file_finder::Toggle", // find-file diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs index 3aa86a434dac611be260eb7f281d9067812c15ac..1a4c3a70a4c6cb622cb90dcd636a845c77c756c6 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(), None, window, cx) + pane.close_other_items(&Default::default(), None, window, cx) .detach(); }); }); diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 43c9c0db659210f68c59e225f1103405c2f14dc1..4efb052c71d284373981157c3ddc0cee8db276c6 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -55,7 +55,7 @@ use util::{ uri, }; use workspace::{ - CloseActiveItem, CloseAllItems, CloseInactiveItems, MoveItemToPaneInDirection, NavigationEntry, + CloseActiveItem, CloseAllItems, CloseOtherItems, MoveItemToPaneInDirection, NavigationEntry, OpenOptions, ViewId, item::{FollowEvent, FollowableItem, Item, ItemHandle, SaveOptions}, }; @@ -21463,7 +21463,7 @@ println!("5"); .unwrap(); pane_1 .update_in(cx, |pane, window, cx| { - pane.close_inactive_items(&CloseInactiveItems::default(), None, window, cx) + pane.close_other_items(&CloseOtherItems::default(), None, window, cx) }) .await .unwrap(); @@ -21499,7 +21499,7 @@ println!("5"); .unwrap(); pane_2 .update_in(cx, |pane, window, cx| { - pane.close_inactive_items(&CloseInactiveItems::default(), None, window, cx) + pane.close_other_items(&CloseOtherItems::default(), None, window, cx) }) .await .unwrap(); diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index 74aed815a2aae5cffaa9e4c7a33b028305658258..23e04cae2c1efda237caf93414d16256f11eff04 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -1085,12 +1085,12 @@ fn generate_commands(_: &App) -> Vec { ), VimCommand::new( ("tabo", "nly"), - workspace::CloseInactiveItems { + workspace::CloseOtherItems { save_intent: Some(SaveIntent::Close), close_pinned: false, }, ) - .bang(workspace::CloseInactiveItems { + .bang(workspace::CloseOtherItems { save_intent: Some(SaveIntent::Skip), close_pinned: false, }), diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 19afd49848db3f63a227a2660486b4f0a9f19d1d..7cc10c27f714bec6480c44cb241d8012eda138d6 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -116,7 +116,8 @@ pub struct CloseActiveItem { #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)] #[action(namespace = pane)] #[serde(deny_unknown_fields)] -pub struct CloseInactiveItems { +#[action(deprecated_aliases = ["pane::CloseInactiveItems"])] +pub struct CloseOtherItems { #[serde(default)] pub save_intent: Option, #[serde(default)] @@ -1354,9 +1355,9 @@ impl Pane { }) } - pub fn close_inactive_items( + pub fn close_other_items( &mut self, - action: &CloseInactiveItems, + action: &CloseOtherItems, target_item_id: Option, window: &mut Window, cx: &mut Context, @@ -2578,7 +2579,7 @@ impl Pane { save_intent: None, close_pinned: true, }; - let close_inactive_items_action = CloseInactiveItems { + let close_inactive_items_action = CloseOtherItems { save_intent: None, close_pinned: false, }; @@ -2610,7 +2611,7 @@ impl Pane { .action(Box::new(close_inactive_items_action.clone())) .disabled(total_items == 1) .handler(window.handler_for(&pane, move |pane, window, cx| { - pane.close_inactive_items( + pane.close_other_items( &close_inactive_items_action, Some(item_id), window, @@ -3521,8 +3522,8 @@ impl Render for Pane { }), ) .on_action( - cx.listener(|pane: &mut Self, action: &CloseInactiveItems, window, cx| { - pane.close_inactive_items(action, None, window, cx) + cx.listener(|pane: &mut Self, action: &CloseOtherItems, window, cx| { + pane.close_other_items(action, None, window, cx) .detach_and_log_err(cx); }), ) @@ -5853,8 +5854,8 @@ mod tests { assert_item_labels(&pane, ["A!", "B!", "C", "D", "E*"], cx); pane.update_in(cx, |pane, window, cx| { - pane.close_inactive_items( - &CloseInactiveItems { + pane.close_other_items( + &CloseOtherItems { save_intent: None, close_pinned: false, }, @@ -5890,8 +5891,8 @@ mod tests { assert_item_labels(&pane, ["A", "B", "C", "D", "E*"], cx); pane.update_in(cx, |pane, window, cx| { - pane.close_inactive_items( - &CloseInactiveItems { + pane.close_other_items( + &CloseOtherItems { save_intent: None, close_pinned: false, }, @@ -6256,8 +6257,8 @@ mod tests { .unwrap(); pane.update_in(cx, |pane, window, cx| { - pane.close_inactive_items( - &CloseInactiveItems { + pane.close_other_items( + &CloseOtherItems { save_intent: None, close_pinned: false, }, diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index be5d693d356e3b328d1f3d0575a76df5c429f7dc..f37abe59e24b64cc8a7e4f699afb1e3cc569a42f 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2793,8 +2793,8 @@ impl Workspace { if retain_active_pane { let current_pane_close = current_pane.update(cx, |pane, cx| { - pane.close_inactive_items( - &CloseInactiveItems { + pane.close_other_items( + &CloseOtherItems { save_intent: None, close_pinned: false, }, @@ -9471,8 +9471,8 @@ mod tests { ); }); let close_all_but_multi_buffer_task = pane.update_in(cx, |pane, window, cx| { - pane.close_inactive_items( - &CloseInactiveItems { + pane.close_other_items( + &CloseOtherItems { save_intent: Some(SaveIntent::Save), close_pinned: true, },