From 932da7468ef8c094c09726440d1e4f26cd4ce00a Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:51:03 +1000 Subject: [PATCH] Prevent preview flicker when directories are reloaded --- app.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index a95b1801..ec60e37b 100644 --- a/app.go +++ b/app.go @@ -388,6 +388,11 @@ func (app *app) loop() { app.nav.dirCache[d.path] = d } + var oldCurrPath string + if curr, err := app.nav.currFile(); err == nil { + oldCurrPath = curr.path + } + for i := range app.nav.dirs { if app.nav.dirs[i].path == d.path { app.nav.dirs[i] = d @@ -398,7 +403,7 @@ func (app *app) loop() { curr, err := app.nav.currFile() if err == nil { - if d.path == app.nav.currDir().path { + if curr.path != oldCurrPath { app.ui.loadFile(app, true) if app.ui.msgIsStat { app.ui.loadFileInfo(app.nav)