mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 12:38:02 +00:00
Merge pull request #543 from zed-industries/fix-closing-items
Ensure `active_item_index` doesn't go off the end when closing items
This commit is contained in:
commit
34bbc05cec
1 changed files with 4 additions and 2 deletions
|
@ -406,11 +406,13 @@ impl Pane {
|
|||
});
|
||||
|
||||
if self.item_views.is_empty() {
|
||||
self.update_active_toolbar(cx);
|
||||
cx.emit(Event::Remove);
|
||||
} else {
|
||||
self.activate_item(new_active_item_index, cx);
|
||||
self.active_item_index = cmp::min(new_active_item_index, self.item_views.len() - 1);
|
||||
self.focus_active_item(cx);
|
||||
self.activate(cx);
|
||||
}
|
||||
self.update_active_toolbar(cx);
|
||||
|
||||
cx.notify();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue