mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-10 09:02:01 -07:00
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user