Add ability to use image previewers (#531)
* Return early on error in nav.preview * nav.checkReg now returns a boolean instead of calling nav.preview * Pass width, height, x, and y parameters to preview script * Check previewer for exit code If non-zero the preview will be assumed to have side-effects. * Add the cleaner option This is called upon selection changes if the previous preview was volatile. To this end, volatilePreview was added to the nav struct
This commit is contained in:
1 parent
c2fe88e9a0
commit
82f03102a5
9 files changed
+98
-25
No files matched your search
@@ -213,6 +213,8 @@ func (app *app) loop() {
|
||||
continue
|
||||
}
|
||||
|
||||
go app.nav.previewClear()
|
||||
|
||||
log.Print("bye!")
|
||||
|
||||
if err := app.writeHistory(); err != nil {
|
||||
@@ -310,7 +312,10 @@ func (app *app) loop() {
|
||||
|
||||
app.ui.draw(app.nav)
|
||||
case r := <-app.nav.regChan:
|
||||
app.nav.checkReg(r)
|
||||
if app.nav.checkReg(r) {
|
||||
win := app.ui.wins[len(app.ui.wins)-1]
|
||||
go app.nav.preview(r.path, win)
|
||||
}
|
||||
|
||||
app.nav.regCache[r.path] = r
|
||||
|
||||
@@ -402,6 +407,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
go app.nav.previewClear()
|
||||
app.ui.pause()
|
||||
defer app.ui.resume()
|
||||
defer app.nav.renew()
|
||||
|
||||
Reference in new issue
Block a user