summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2019-02-22 14:33:29 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2019-02-22 14:36:30 +0900
commit8dc1377efb140c40c7e121b29d9cedb52ad9ea9f (patch)
treea7ad4c0eb63da379a3865ce5369541ea02536ef2 /src
parent6c32148f9020e222bae335fa823229715e067815 (diff)
downloadfzf-8dc1377efb140c40c7e121b29d9cedb52ad9ea9f.tar.gz
Export FZF_PREVIEW_LINES and FZF_PREVIEW_COLUMNS to preview process
fzf will still override LINES and COLUMNS as before but they may not hold the correct values depending on the default shell. Close #1314
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go
index c807a4ba..4eaf3f0b 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -613,7 +613,6 @@ func (t *Terminal) resizeWindows() {
pwidth += 1
}
t.pwindow = t.tui.NewWindow(y+1, x+2, pwidth, h-2, tui.BorderNone)
- os.Setenv("FZF_PREVIEW_HEIGHT", strconv.Itoa(h-2))
}
switch t.preview.position {
case posUp:
@@ -1492,8 +1491,12 @@ func (t *Terminal) Loop() {
cmd := util.ExecCommand(command, true)
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()))
+ lines := fmt.Sprintf("LINES=%d", t.pwindow.Height())
+ columns := fmt.Sprintf("COLUMNS=%d", t.pwindow.Width())
+ env = append(env, lines)
+ env = append(env, "FZF_PREVIEW_"+lines)
+ env = append(env, columns)
+ env = append(env, "FZF_PREVIEW_"+columns)
cmd.Env = env
}
var out bytes.Buffer