From 89a6697d471ba6ad62e2d7f763bee19b0a80fe5d Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Sun, 8 Feb 2026 19:06:44 +1100 Subject: [PATCH] fix: check directory for changes during `select` (#2377) * fix: check directory for changes during `select` * Update `CHANGELOG.md` --- CHANGELOG.md | 1 + eval.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b781d9b..4a5a2c4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - 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). +- The `select` command can now select files immediately after creation as part of a script (#2377). ## [r41](https://github.com/gokcehan/lf/releases/tag/r41) diff --git a/eval.go b/eval.go index f80bbf0a..e79ae492 100644 --- a/eval.go +++ b/eval.go @@ -1544,12 +1544,12 @@ func (e *callExpr) eval(app *app, _ []string) { } dir := app.nav.currDir() + app.nav.checkDir(dir) if dir.loading { dir.files = append(dir.files, &file{FileInfo: lstat}) - } else { - app.nav.currDir().sel(filepath.Base(path), app.nav.height) - app.ui.loadFile(app, true) } + dir.sel(filepath.Base(path), app.nav.height) + app.ui.loadFile(app, true) case "source": if len(e.args) != 1 { app.ui.echoerr("source: requires an argument")