Skip to content

Commit

Permalink
Remove environment exports from preview thread (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelim-work authored Jul 27, 2023
1 parent 95b3613 commit 2620f49
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ Format string of the box drawing characters enabled by the `drawbox` option.
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.
The following arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, (5) vertical position of preview pane and (6) next file name to be previewed respectively.
Preview cleaning is disabled when the value of this option is left empty.
cursoractivefmt string (default "\033[7m")
Expand Down Expand Up @@ -844,7 +844,7 @@ Files containing the null character (U+0000) in the read portion are considered
Set the path of a previewer file to filter the content of regular files for previewing.
The file should be executable.
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.
The following 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.
SIGPIPE signal is sent when enough lines are read.
If the previewer returns a non-zero exit code, then the preview cache for the given file is disabled.
This means that if the file is selected in the future, the previewer is called once again.
Expand Down
13 changes: 7 additions & 6 deletions docstring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 cleaning 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. The following arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, (5) vertical position of preview pane and (6) next file name to be previewed respectively. Preview cleaning is disabled when the value of this option is left empty.
.PP
.EX
cursoractivefmt string (default "\e033[7m")
Expand Down Expand Up @@ -1021,7 +1021,7 @@ Show previews of files and directories at the right most pane. If the file has m
previewer string (default '') (not filtered if empty)
.EE
.PP
Set the path of a previewer file to filter the content of regular files for previewing. The file should be executable. 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. SIGPIPE signal is sent when enough lines are read. If the previewer returns a non-zero exit code, then the preview cache for the given file is disabled. This means that if the file is selected in the future, the previewer is called once again. Preview filtering is disabled and files are displayed as they are when the value of this option is left empty.
Set the path of a previewer file to filter the content of regular files for previewing. The file should be executable. The following 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. SIGPIPE signal is sent when enough lines are read. If the previewer returns a non-zero exit code, then the preview cache for the given file is disabled. This means that if the file is selected in the future, the previewer is called once again. Preview filtering is disabled and files are displayed as they are when the value of this option is left empty.
.PP
.EX
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
Expand Down
9 changes: 2 additions & 7 deletions nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,12 @@ func (nav *nav) previewLoop(ui *ui) {
}
win := ui.wins[len(ui.wins)-1]
if clear && len(gOpts.previewer) != 0 && len(gOpts.cleaner) != 0 && nav.volatilePreview {
nav.exportFiles()
exportOpts()
cmd := exec.Command(gOpts.cleaner, prev,
strconv.Itoa(win.w),
strconv.Itoa(win.h),
strconv.Itoa(win.x),
strconv.Itoa(win.y))
strconv.Itoa(win.y),
path)
if err := cmd.Run(); err != nil {
log.Printf("cleaning preview: %s", err)
}
Expand Down Expand Up @@ -747,8 +746,6 @@ func (nav *nav) previewDir(dir *dir, win *win) {
var reader io.Reader

if len(gOpts.previewer) != 0 {
nav.exportFiles()
exportOpts()
cmd := exec.Command(gOpts.previewer, dir.path,
strconv.Itoa(win.w),
strconv.Itoa(win.h),
Expand Down Expand Up @@ -807,8 +804,6 @@ func (nav *nav) preview(path string, win *win) {
var reader io.Reader

if len(gOpts.previewer) != 0 {
nav.exportFiles()
exportOpts()
cmd := exec.Command(gOpts.previewer, path,
strconv.Itoa(win.w),
strconv.Itoa(win.h),
Expand Down

0 comments on commit 2620f49

Please sign in to comment.