Skip to content
Myr

sixel: Export $FZF_PREVIEW_TOP to the preview command (#2544)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

So that it can determine if it should subtract 1 from $FZF_PREVIEW_LINES to avoid scrolling issue of Sixel image that touches the bottom of the screen.

authored by Junegunn Choi · committed by Junegunn Choi · parent a0145ce · Browse files · 7 files+35 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

7 files+35 added−10 removed

  • other:+35 added−10 removed

7 files+35 added−10 removed

modified:bin/fzf-preview.sh+20 added-7 removed
modified:man/man1/fzf.1+3 added
546 unmodified lines
547\fB$LINES\fR and \fB$COLUMNS\fR with the same values but they can be reset548by the default shell, so prefer to refer to the ones with \fBFZF_PREVIEW_\fR549prefix.)550551fzf also exports \fB$FZF_PREVIEW_TOP\fR and \fB$FZF_PREVIEW_LEFT\fR so that552the preview command can determine the position of the preview window.553554A placeholder expression starting with \fB+\fR flag will be replaced to the555space-separated list of the selected lines (or the current line if no selection556was made) individually quoted.557
802 unmodified lines
modified:src/tui/dummy.go+1 added
39 unmodified lines
40func (r *FullscreenRenderer) Close() {}41func (r *FullscreenRenderer) Size() TermSize { return TermSize{} }4243func (r *FullscreenRenderer) GetChar() Event { return Event{} }44func (r *FullscreenRenderer) Top() int { return 0 }45func (r *FullscreenRenderer) MaxX() int { return 0 }46func (r *FullscreenRenderer) MaxY() int { return 0 }4748func (r *FullscreenRenderer) RefreshWindows(windows []Window) {}
4 unmodified lines
modified:src/tui/light.go+4 added
718 unmodified lines
719 r.closePlatform()720 r.restoreTerminal()721}722723func (r *LightRenderer) Top() int {724 return r.yoffset725}726727func (r *LightRenderer) MaxX() int {728 return r.width729}730
381 unmodified lines
modified:src/tui/tcell.go+4 added
170 unmodified lines
171 r.initScreen()172 initTheme(r.theme, r.defaultTheme(), r.forceBlack)173}174175func (r *FullscreenRenderer) Top() int {176 return 0177}178179func (r *FullscreenRenderer) MaxX() int {180 ncols, _ := _screen.Size()181 return int(ncols)182}
602 unmodified lines
modified:src/tui/tui.go+1 added
492 unmodified lines
493 NeedScrollbarRedraw() bool494495 GetChar() Event496497 Top() int498 MaxX() int499 MaxY() int500501 Size() TermSize
311 unmodified lines
modified:src/terminal.go+2 added-3 removed
2065 unmodified lines
2066 t.tui.PassThrough(passThrough)20672068 if requiredLines > 0 {2069 if y+requiredLines == height {2070 if t.tui.MaxY() == t.pwindow.Top()+height {2071 t.tui.PassThrough("\x1b[1T")2072 }2070 t.pwindow.Move(height-1, maxWidth-1)2071 t.previewed.filled = true2072 break Loop2073 } else {
712 unmodified lines
2786 env = append(env, lines)2787 env = append(env, "FZF_PREVIEW_"+lines)2788 env = append(env, columns)2789 env = append(env, "FZF_PREVIEW_"+columns)2790 env = append(env, fmt.Sprintf("FZF_PREVIEW_TOP=%d", t.tui.Top()+t.pwindow.Top()))2791 env = append(env, fmt.Sprintf("FZF_PREVIEW_LEFT=%d", t.pwindow.Left()))2792 }2793 cmd.Env = env27942795 out, _ := cmd.StdoutPipe()
1210 unmodified lines