fix: prevent preview flicker when terminal height decreases (#2537)

* fix preview flicker

* address preview height increase

* check cached preview height

* improve patch

* improve patch

* fix patch
This commit is contained in:
valoq authored and GitHub committed 2026-05-16 10:47:14 +10:00
1 parent 39da022fcc
commit eebc6e4488
1 file changed
+12 -1
+12 -1
View File
@@ -676,6 +676,8 @@ func (nav *nav) resize(ui *ui) {
return
}
widthChanged := previewWin.w != nav.previewWidth
nav.height = previewWin.h
nav.previewWidth = previewWin.w
@@ -683,7 +685,16 @@ func (nav *nav) resize(ui *ui) {
nav.getDir(path).boundPos(nav.height)
}
clear(nav.regCache)
if widthChanged {
clear(nav.regCache)
} else {
// drop entries that no longer match the new pane height
for path, r := range nav.regCache {
if r.loading || r.sixel || (previewWin.h > len(r.lines) && len(r.lines) == r.height) {
delete(nav.regCache, path)
}
}
}
nav.preloadTimer.Reset(200 * time.Millisecond)
}