From de2e622be5fa59979ff2c9bb0e41390a14b97649 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 9 Aug 2026 12:02:03 +0700 Subject: [PATCH] fix(diff): a read that failed must not overwrite the sidebar's counts The overlay says "could not read the diff" in words, and then published the failed read's zero totals over the +N -N the row already had right. --- src/ui/diff_overlay.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/diff_overlay.rs b/src/ui/diff_overlay.rs index 82159116..be0c5d14 100644 --- a/src/ui/diff_overlay.rs +++ b/src/ui/diff_overlay.rs @@ -185,7 +185,12 @@ impl Tty7App { // +N −N asks, and it is the one the reader is looking at. Hand the // numbers back before anything renders, or the row can disagree with // the overlay it just opened. - let mut landed = if let Some(snap) = snap.as_ref() { + // + // A read that failed is not an answer at all: its totals are whatever + // got parsed before git gave up, usually zero. Publishing those wipes + // the counts the sidebar already had right — the overlay says so in + // words a few lines below, and the row would silently disagree. + let mut landed = if let Some(snap) = snap.as_ref().filter(|s| !s.read_failed) { let (added, removed) = snap.totals(); let root = snap.root.clone(); cx.default_global::();