Inject $LINES and $COLUMNS when running preview command

Close #1168
This commit is contained in:
Junegunn Choi
2017-12-01 03:27:58 +09:00
parent b3b101a89c
commit f6b1962056
3 changed files with 14 additions and 5 deletions

View File

@@ -1368,6 +1368,12 @@ func (t *Terminal) Loop() {
command := replacePlaceholder(t.preview.command,
t.ansi, t.delimiter, false, string(t.input), request)
cmd := util.ExecCommand(command)
if t.pwindow != nil {
env := os.Environ()
env = append(env, fmt.Sprintf("LINES=%d", t.pwindow.Height()))
env = append(env, fmt.Sprintf("COLUMNS=%d", t.pwindow.Width()))
cmd.Env = env
}
out, _ := cmd.CombinedOutput()
t.reqBox.Set(reqPreviewDisplay, string(out))
} else {