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:
parent
f0565b4e2e
commit
44c6a54f95
9 changed files with 298 additions and 36 deletions
|
@ -567,37 +567,45 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
|||
("q", "uit"),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Close),
|
||||
close_pinned: false,
|
||||
},
|
||||
)
|
||||
.bang(workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Skip),
|
||||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(
|
||||
("wq", ""),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Save),
|
||||
close_pinned: false,
|
||||
},
|
||||
)
|
||||
.bang(workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Overwrite),
|
||||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(
|
||||
("x", "it"),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::SaveAll),
|
||||
close_pinned: false,
|
||||
},
|
||||
)
|
||||
.bang(workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Overwrite),
|
||||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(
|
||||
("ex", "it"),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::SaveAll),
|
||||
close_pinned: false,
|
||||
},
|
||||
)
|
||||
.bang(workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Overwrite),
|
||||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(
|
||||
("up", "date"),
|
||||
|
@ -657,10 +665,12 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
|||
("bd", "elete"),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Close),
|
||||
close_pinned: false,
|
||||
},
|
||||
)
|
||||
.bang(workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Skip),
|
||||
close_pinned: true,
|
||||
}),
|
||||
VimCommand::new(("bn", "ext"), workspace::ActivateNextItem).count(),
|
||||
VimCommand::new(("bN", "ext"), workspace::ActivatePrevItem).count(),
|
||||
|
@ -679,6 +689,7 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
|||
("tabc", "lose"),
|
||||
workspace::CloseActiveItem {
|
||||
save_intent: Some(SaveIntent::Close),
|
||||
close_pinned: false,
|
||||
},
|
||||
),
|
||||
VimCommand::new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue