pane: Improve close active item to better handle pinned tabs (#23488)

Closes #22247

- [x] Do not close pinned tab on keyboard shortcuts like `ctrl+w` or
`alt+f4`
- [x] Close pinned tab on context menu action, menu bar action, or vim
bang
- [x] While closing pinned tab via shortcut (where it won't close),
instead activate any other non-pinned tab in same pane
- [x] Else, if any other pane contains non-pinned tab, activate that
- [x] Tests

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>

Release Notes:

- Pinned tab now stay open when using close shortcuts, auto focuses to
any other non-pinned tab instead.
This commit is contained in:
smit 2025-02-07 22:54:57 +05:30 committed by GitHub
parent f0565b4e2e
commit 44c6a54f95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 298 additions and 36 deletions

View file

@ -817,7 +817,10 @@ async fn test_external_files_history(cx: &mut gpui::TestAppContext) {
.as_u64() as usize,
)
});
cx.dispatch_action(workspace::CloseActiveItem { save_intent: None });
cx.dispatch_action(workspace::CloseActiveItem {
save_intent: None,
close_pinned: false,
});
let initial_history_items =
open_close_queried_buffer("sec", 1, "second.rs", &workspace, cx).await;
@ -2000,7 +2003,10 @@ async fn open_close_queried_buffer(
)
.await;
cx.dispatch_action(workspace::CloseActiveItem { save_intent: None });
cx.dispatch_action(workspace::CloseActiveItem {
save_intent: None,
close_pinned: false,
});
history_items
}