diff --git a/src/app.rs b/src/app.rs index 2bedc3a8..fd51fbd2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -138,6 +138,7 @@ impl App { pub fn event(&mut self, ev: Event) { trace!("event: {:?}", ev); if self.commit.event(ev) { + self.update_diff(); return; } @@ -221,6 +222,8 @@ impl App { ), ); } + } else { + self.diff.clear(); } } diff --git a/src/components/diff.rs b/src/components/diff.rs index 528f46ba..6cc486fe 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -31,6 +31,11 @@ impl DiffComponent { self.current_path.clone() } /// + pub fn clear(&mut self) { + self.current_path.clear(); + self.diff = Diff::default(); + } + /// pub fn update(&mut self, path: String, diff: Diff) { self.current_path = path; if diff != self.diff {