Skip to content

Commit

Permalink
fix: Exclude pinned tabs when closing all items
Browse files Browse the repository at this point in the history
This fix is only for closing all items. It could easily be expanded to
also handle closes to left and right.
  • Loading branch information
Axel Carlsson committed Oct 23, 2024
1 parent d53a86b commit 3182e13
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions crates/workspace/src/pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,11 +1206,25 @@ impl Pane {
return None;
}

Some(
self.close_items(cx, action.save_intent.unwrap_or(SaveIntent::Close), |_| {
true
}),
)
// Close all un-pinned tabs.
let items_to_close: Vec<_> = self
.items
.iter()
.map(|item| item.item_id())
.filter(|item_id| {
if let Some(ix) = self.index_for_item_id(*item_id) {
!self.is_tab_pinned(ix)
} else {
true
}
})
.collect();

Some(self.close_items(
cx,
action.save_intent.unwrap_or(SaveIntent::Close),
|item_id| items_to_close.contains(&item_id),
))
}

pub(super) fn file_names_for_prompt(
Expand Down

0 comments on commit 3182e13

Please sign in to comment.