mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
fix rare showing of wrong diff
This commit is contained in:
parent
c72678d367
commit
8f6a7bd330
2 changed files with 7 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ use std::{
|
|||
};
|
||||
|
||||
///
|
||||
#[derive(Default, Hash, Clone)]
|
||||
#[derive(Default, Hash, Clone, PartialEq)]
|
||||
pub struct DiffParams(pub String, pub bool);
|
||||
|
||||
struct Request<R, A>(R, Option<A>);
|
||||
|
|
@ -42,10 +42,10 @@ impl AsyncDiff {
|
|||
}
|
||||
|
||||
///
|
||||
pub fn last(&mut self) -> Option<FileDiff> {
|
||||
pub fn last(&mut self) -> Option<(DiffParams, FileDiff)> {
|
||||
let last = self.last.lock().unwrap();
|
||||
if let Some(res) = last.clone() {
|
||||
Some(res.result)
|
||||
Some((res.params, res.result))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,8 +281,10 @@ impl App {
|
|||
if self.diff.current() == (path.clone(), is_stage) {
|
||||
// we are already showing a diff of the right file
|
||||
// maybe the diff changed (outside file change)
|
||||
if let Some(last) = self.git_diff.last() {
|
||||
self.diff.update(path, is_stage, last);
|
||||
if let Some((params, last)) = self.git_diff.last() {
|
||||
if params == diff_params {
|
||||
self.diff.update(path, is_stage, last);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// we dont show the right diff right now, so we need to request
|
||||
|
|
|
|||
Loading…
Reference in a new issue