Populate backward/forward stacks upon item deactivation

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-17 18:57:31 +01:00
parent bbf634f439
commit ea624c6cde
4 changed files with 121 additions and 56 deletions

View file

@ -147,7 +147,7 @@ pub trait ItemView: View {
type ItemHandle: ItemHandle;
fn added_to_pane(&mut self, _: Rc<Navigation>, _: &mut ViewContext<Self>) {}
fn activated(&mut self, _: &mut ViewContext<Self>) {}
fn deactivated(&mut self, _: &mut ViewContext<Self>) {}
fn item_handle(&self, cx: &AppContext) -> Self::ItemHandle;
fn title(&self, cx: &AppContext) -> String;
fn project_path(&self, cx: &AppContext) -> Option<ProjectPath>;
@ -210,7 +210,7 @@ pub trait ItemViewHandle {
fn boxed_clone(&self) -> Box<dyn ItemViewHandle>;
fn clone_on_split(&self, cx: &mut MutableAppContext) -> Option<Box<dyn ItemViewHandle>>;
fn added_to_pane(&mut self, cx: &mut ViewContext<Pane>);
fn activated(&mut self, cx: &mut MutableAppContext);
fn deactivated(&self, cx: &mut MutableAppContext);
fn id(&self) -> usize;
fn to_any(&self) -> AnyViewHandle;
fn is_dirty(&self, cx: &AppContext) -> bool;
@ -363,8 +363,8 @@ impl<T: ItemView> ItemViewHandle for ViewHandle<T> {
.detach();
}
fn activated(&mut self, cx: &mut MutableAppContext) {
self.update(cx, |this, cx| this.activated(cx));
fn deactivated(&self, cx: &mut MutableAppContext) {
self.update(cx, |this, cx| this.deactivated(cx));
}
fn save(&self, cx: &mut MutableAppContext) -> Result<Task<Result<()>>> {