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

Closes #33445

Fixed the "Close others" context menu action to close tabs relative to
the right-clicked tab instead of the currently active tab. Previously,
when right-clicking on an inactive tab and selecting "Close others", it
would keep the active tab open rather than the right-clicked tab.

## Before/After

https://github.com/user-attachments/assets/d76854c3-c490-4a41-8166-309dec26ba8a



## Changes

- Modified `close_inactive_items()` method to accept an optional
`target_item_id` parameter
- Updated context menu handler to pass the right-clicked tab's ID as the
target
- Maintained backward compatibility by defaulting to active tab when no
target is specified
- Updated all existing call sites to pass `None` for the new parameter

Release Notes:

- Fixed: "Close others" context menu action now correctly keeps the
right-clicked tab open instead of the active tab
This commit is contained in:
vipex 2025-07-14 13:06:40 +02:00 committed by GitHub
parent 84124c60db
commit 00ec243771
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 5 deletions

View file

@ -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,
)