From 278dce9ba6f383930654b9a591f1143b0c422907 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 31 Oct 2023 23:29:47 +0900 Subject: [PATCH] Restore scroll after rendering full-height Sixel image (#2544) When a Sixel image touches the bottom of the screen, the whole screen scrolls up one line to make room for the cursor. Add an ANSI escape code to compensate for the movement. Unfortunately, the movement of the screen is sometimes noticeable. fzf --preview='fzf-preview.sh {}' --preview-window border-left --- src/terminal.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/terminal.go b/src/terminal.go index 2e36e13..6e198ba 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -2061,7 +2061,10 @@ Loop: if requiredLines > 0 { if y+requiredLines == height { - t.pwindow.Move(y+requiredLines, 0) + 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 } else {