diff --git a/doc.go b/doc.go index f4baab2b..5a7e2e2b 100644 --- a/doc.go +++ b/doc.go @@ -674,7 +674,7 @@ Set the path of a cleaner file. The file should be executable. This file is called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, and (5) vertical position of preview pane respectively. -Preview clearing is disabled when the value of this option is left empty. +Preview cleaning is disabled when the value of this option is left empty. cursoractivefmt string (default "\033[7m") cursorparentfmt string (default "\033[7m") diff --git a/docstring.go b/docstring.go index 8c4fe02a..ef2d522e 100644 --- a/docstring.go +++ b/docstring.go @@ -706,7 +706,7 @@ Set the path of a cleaner file. The file should be executable. This file is called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, -and (5) vertical position of preview pane respectively. Preview clearing is +and (5) vertical position of preview pane respectively. Preview cleaning is disabled when the value of this option is left empty. cursoractivefmt string (default "\033[7m") diff --git a/eval.go b/eval.go index 81e46811..334550e2 100644 --- a/eval.go +++ b/eval.go @@ -611,12 +611,14 @@ func (e *setExpr) eval(app *app, args []string) { app.ui.echoerr("preview: value should be empty, 'true', or 'false'") return } + app.ui.loadFile(app, true) case "nopreview": if e.val != "" { app.ui.echoerrf("nopreview: unexpected value: %s", e.val) return } gOpts.preview = false + app.ui.loadFile(app, true) case "preview!": if e.val != "" { app.ui.echoerrf("preview!: unexpected value: %s", e.val) @@ -627,6 +629,7 @@ func (e *setExpr) eval(app *app, args []string) { return } gOpts.preview = !gOpts.preview + app.ui.loadFile(app, true) case "previewer": gOpts.previewer = replaceTilde(e.val) case "promptfmt": diff --git a/lf.1 b/lf.1 index fd4b37ed..da6a08d1 100644 --- a/lf.1 +++ b/lf.1 @@ -825,7 +825,7 @@ Format string of the box drawing characters enabled by the `drawbox` option. cleaner string (default '') (not called if empty) .EE .PP -Set the path of a cleaner file. The file should be executable. This file is called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, and (5) vertical position of preview pane respectively. Preview clearing is disabled when the value of this option is left empty. +Set the path of a cleaner file. The file should be executable. This file is called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, and (5) vertical position of preview pane respectively. Preview cleaning is disabled when the value of this option is left empty. .PP .EX cursoractivefmt string (default "\e033[7m") diff --git a/ui.go b/ui.go index 1a286a96..724a1ce8 100644 --- a/ui.go +++ b/ui.go @@ -696,14 +696,14 @@ func (ui *ui) loadFile(app *app, volatile bool) { onSelect(app) } - if !gOpts.preview { - return - } - if volatile { app.nav.previewChan <- "" } + if !gOpts.preview { + return + } + if curr.IsDir() { ui.dirPrev = app.nav.loadDir(curr.path) } else if curr.Mode().IsRegular() {