Pass width and height to the previewer

This way, the script can do a little magic like

 head -n $2 $1 | highlight -O ansi --syntax ${1##*.}

to avoid reading whole (possibly huge) file.
This commit is contained in:
KenjiTakahashi 2016-08-31 20:46:35 +02:00
parent f356e6d694
commit 8d4a3192f1

2
ui.go
View File

@ -257,7 +257,7 @@ func (win *Win) printr(reg *os.File) error {
} }
if len(gOpts.previewer) != 0 { if len(gOpts.previewer) != 0 {
cmd := exec.Command(gOpts.previewer, reg.Name()) cmd := exec.Command(gOpts.previewer, reg.Name(), strconv.Itoa(win.w), strconv.Itoa(win.h))
out, err := cmd.Output() out, err := cmd.Output()
if err != nil { if err != nil {