update diff after commit

This commit is contained in:
Stephan Dilly 2020-03-20 19:31:01 +01:00
parent 3ce4a51b04
commit 55e9fe643b
2 changed files with 8 additions and 0 deletions

View file

@ -138,6 +138,7 @@ impl App {
pub fn event(&mut self, ev: Event) { pub fn event(&mut self, ev: Event) {
trace!("event: {:?}", ev); trace!("event: {:?}", ev);
if self.commit.event(ev) { if self.commit.event(ev) {
self.update_diff();
return; return;
} }
@ -221,6 +222,8 @@ impl App {
), ),
); );
} }
} else {
self.diff.clear();
} }
} }

View file

@ -31,6 +31,11 @@ impl DiffComponent {
self.current_path.clone() 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) { pub fn update(&mut self, path: String, diff: Diff) {
self.current_path = path; self.current_path = path;
if diff != self.diff { if diff != self.diff {