Reduce flickering of the scroll info panel on the preview window

This commit is contained in:
Junegunn Choi 2023-01-05 01:55:59 +09:00
parent 03d02d67f7
commit ee5cdb9713
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -1682,6 +1682,7 @@ func (t *Terminal) renderPreviewArea(unchanged bool) {
func (t *Terminal) renderPreviewText(height int, lines []string, lineNo int, unchanged bool) { func (t *Terminal) renderPreviewText(height int, lines []string, lineNo int, unchanged bool) {
maxWidth := t.pwindow.Width() maxWidth := t.pwindow.Width()
var ansi *ansiState var ansi *ansiState
spinnerRedraw := t.pwindow.Y() == 0
for _, line := range lines { for _, line := range lines {
var lbg tui.Color = -1 var lbg tui.Color = -1
if ansi != nil { if ansi != nil {
@ -1693,6 +1694,13 @@ func (t *Terminal) renderPreviewText(height int, lines []string, lineNo int, unc
t.previewer.scrollable = true t.previewer.scrollable = true
break break
} else if lineNo >= 0 { } else if lineNo >= 0 {
if spinnerRedraw && lineNo > 0 {
spinnerRedraw = false
y := t.pwindow.Y()
x := t.pwindow.X()
t.renderPreviewSpinner()
t.pwindow.Move(y, x)
}
var fillRet tui.FillReturn var fillRet tui.FillReturn
prefixWidth := 0 prefixWidth := 0
_, _, ansi = extractColor(line, ansi, func(str string, ansi *ansiState) bool { _, _, ansi = extractColor(line, ansi, func(str string, ansi *ansiState) bool {