From 16b21e48f230f05458751fad78fb258e0ca1d353 Mon Sep 17 00:00:00 2001 From: CatsDeservePets <145048791+CatsDeservePets@users.noreply.github.com> Date: Sat, 7 Feb 2026 09:03:15 +0100 Subject: [PATCH] fix: update preview on `visual-change` (#2373) --- CHANGELOG.md | 1 + eval.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba1a2bf..03eaaf2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Fixed - Previews are now cleaned when changing to an empty directory (#2369). +- Previews are now correctly updated on `visual-change` (#2373). - The `dircounts` indicator for errors is changed back to `!` instead of `?` (#2372). ## [r41](https://github.com/gokcehan/lf/releases/tag/r41) diff --git a/eval.go b/eval.go index d25e3b74..f80bbf0a 100644 --- a/eval.go +++ b/eval.go @@ -1665,11 +1665,15 @@ func (e *callExpr) eval(app *app, _ []string) { return } dir := app.nav.currDir() + old := dir.ind beg := max(dir.ind-dir.pos, 0) dir.ind, dir.visualAnchor = dir.visualAnchor, dir.ind dir.pos = dir.ind - beg dir.visualWrap = -dir.visualWrap dir.boundPos(app.nav.height) + if old != dir.ind { + app.ui.loadFile(app, true) + } case "cmd-insert": if len(e.args) == 0 { return