summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-10-31 23:29:47 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-10-31 23:38:01 +0900
commit278dce9ba6f383930654b9a591f1143b0c422907 (patch)
tree27fff36e875d0acc6612b69581fc2efc2784800e
parent1cfa3ee4c7c1741fca3cd26fb13451621d14bbf2 (diff)
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
-rw-r--r--src/terminal.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 2e36e13f..6e198ba2 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 {