Problem: toggling large diffs via fugitive's `=` caused the top of the
buffer to re-render and glitch. ensure_cache always created a new cache
entry with pending_clear=true and highlighted={}, forcing on_win to
clear and re-highlight every visible hunk — including stable ones above
the toggle point that never changed.
Solution: on reparse, compare old and new hunk lists using a prefix +
suffix matching strategy. Hunks that match (same filename, line count,
and sampled content) carry forward their highlighted state so on_win
skips them. Comparison is O(1) per hunk. Only runs when old entry had
pending_clear=false; invalidate_cache/ColorScheme paths still force
full re-highlight.
Closes #131
|
||
|---|---|---|
| .. | ||
| diffs | ||