diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-11-02 01:35:36 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-11-02 01:35:36 +0900 |
| commit | 21ab64e96213ec99cf3f6f207690ffe710713fcc (patch) | |
| tree | 3d1ebb4ea016827751987abff3f6890d137682f9 /src | |
| parent | a0145cebf284898fce182d78a1edae7270d16f57 (diff) | |
| download | fzf-21ab64e96213ec99cf3f6f207690ffe710713fcc.tar.gz | |
sixel: Export $FZF_PREVIEW_TOP to the preview command (#2544)
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/terminal.go | 5 | ||||
| -rw-r--r-- | src/tui/dummy.go | 1 | ||||
| -rw-r--r-- | src/tui/light.go | 4 | ||||
| -rw-r--r-- | src/tui/tcell.go | 4 | ||||
| -rw-r--r-- | src/tui/tui.go | 1 |
5 files changed, 12 insertions, 3 deletions
diff --git a/src/terminal.go b/src/terminal.go index 494fa462..878e3d9a 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -2067,9 +2067,6 @@ Loop: if requiredLines > 0 { if y+requiredLines == height { - if t.tui.MaxY() == t.pwindow.Top()+height { - t.tui.PassThrough("\x1b[1T") - } t.pwindow.Move(height-1, maxWidth-1) t.previewed.filled = true break Loop @@ -2790,6 +2787,8 @@ func (t *Terminal) Loop() { env = append(env, "FZF_PREVIEW_"+lines) env = append(env, columns) env = append(env, "FZF_PREVIEW_"+columns) + env = append(env, fmt.Sprintf("FZF_PREVIEW_TOP=%d", t.tui.Top()+t.pwindow.Top())) + env = append(env, fmt.Sprintf("FZF_PREVIEW_LEFT=%d", t.pwindow.Left())) } cmd.Env = env diff --git a/src/tui/dummy.go b/src/tui/dummy.go index 13c2aeec..cceb4478 100644 --- a/src/tui/dummy.go +++ b/src/tui/dummy.go @@ -41,6 +41,7 @@ func (r *FullscreenRenderer) Close() {} func (r *FullscreenRenderer) Size() TermSize { return TermSize{} } func (r *FullscreenRenderer) GetChar() Event { return Event{} } +func (r *FullscreenRenderer) Top() int { return 0 } func (r *FullscreenRenderer) MaxX() int { return 0 } func (r *FullscreenRenderer) MaxY() int { return 0 } diff --git a/src/tui/light.go b/src/tui/light.go index e9cf04eb..d26a48f6 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -720,6 +720,10 @@ func (r *LightRenderer) Close() { r.restoreTerminal() } +func (r *LightRenderer) Top() int { + return r.yoffset +} + func (r *LightRenderer) MaxX() int { return r.width } diff --git a/src/tui/tcell.go b/src/tui/tcell.go index cd723e32..d0a710a3 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -172,6 +172,10 @@ func (r *FullscreenRenderer) Init() { initTheme(r.theme, r.defaultTheme(), r.forceBlack) } +func (r *FullscreenRenderer) Top() int { + return 0 +} + func (r *FullscreenRenderer) MaxX() int { ncols, _ := _screen.Size() return int(ncols) diff --git a/src/tui/tui.go b/src/tui/tui.go index 2ebb5e72..7ba437aa 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -494,6 +494,7 @@ type Renderer interface { GetChar() Event + Top() int MaxX() int MaxY() int |
