fix: clean preview if directory is empty (#2369)

* fix: clean preview if directory is empty

* Update `CHANGELOG.md`
This commit is contained in:
Joe Lim authored and GitHub committed 2026-02-07 18:27:24 +11:00
1 parent 18ab3cf650
commit 1ed9e96aa2
2 files changed
+8 -4

No files matched your search

+4
View File
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## Unreleased ## Unreleased
### Fixed
- Previews are now cleaned when changing to an empty directory (#2369).
## [r41](https://github.com/gokcehan/lf/releases/tag/r41) ## [r41](https://github.com/gokcehan/lf/releases/tag/r41)
### Changed ### Changed
+4 -4
View File
@@ -744,6 +744,10 @@ type reg struct {
} }
func (ui *ui) loadFile(app *app, volatile bool) { func (ui *ui) loadFile(app *app, volatile bool) {
if volatile {
app.nav.previewChan <- ""
}
curr := app.nav.currFile() curr := app.nav.currFile()
if curr == nil { if curr == nil {
return return
@@ -754,10 +758,6 @@ func (ui *ui) loadFile(app *app, volatile bool) {
onSelect(app) onSelect(app)
} }
if volatile {
app.nav.previewChan <- ""
}
if !gOpts.preview { if !gOpts.preview {
return return
} }