diff --git a/app.go b/app.go index 4b80278..a35c5ba 100644 --- a/app.go +++ b/app.go @@ -448,17 +448,6 @@ func (app *app) loop() { } } -func (app *app) exportFiles() { - var currFile string - if curr, err := app.nav.currFile(); err == nil { - currFile = curr.path - } - - currSelections := app.nav.currSelections() - - exportFiles(currFile, currSelections, app.nav.currDir().path) -} - // This function is used to run a shell command. Modes are as follows: // // Prefix Wait Async Stdin Stdout Stderr UI action @@ -467,7 +456,7 @@ func (app *app) exportFiles() { // ! Yes No Yes Yes Yes Pause and then resume // & No Yes No No No Do nothing func (app *app) runShell(s string, args []string, prefix string) { - app.exportFiles() + app.nav.exportFiles() exportOpts() cmd := shellCommand(s, args) diff --git a/nav.go b/nav.go index 815e18e..79838e4 100644 --- a/nav.go +++ b/nav.go @@ -518,6 +518,17 @@ func (nav *nav) position() { } } +func (nav *nav) exportFiles() { + var currFile string + if curr, err := nav.currFile(); err == nil { + currFile = curr.path + } + + currSelections := nav.currSelections() + + exportFiles(currFile, currSelections, nav.currDir().path) +} + func (nav *nav) previewLoop(ui *ui) { var prev string for path := range nav.previewChan { @@ -532,6 +543,8 @@ func (nav *nav) previewLoop(ui *ui) { } } if clear && len(gOpts.previewer) != 0 && len(gOpts.cleaner) != 0 && nav.volatilePreview { + nav.exportFiles() + exportOpts() cmd := exec.Command(gOpts.cleaner, prev) if err := cmd.Run(); err != nil { log.Printf("cleaning preview: %s", err) @@ -568,6 +581,7 @@ 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),