Skip to content

Commit

Permalink
Restore scroll after rendering full-height Sixel image (#2544)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
junegunn committed Oct 31, 2023
1 parent 1cfa3ee commit 278dce9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 278dce9

Please sign in to comment.