Skip to content
Myr

Fix Sixel issues (#2544)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Fix regression where previous image is not properly cleared * Change the way fzf calculates the number of required lines to display an image (ceil -> floor) to fix the issue where an image is always rendered as a wireframe.

authored by Junegunn Choi · committed by Junegunn Choi · parent ec208af · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:src/terminal.go+3 added-3 removed
1934 unmodified lines
1935}19361937func (t *Terminal) renderPreviewArea(unchanged bool) {1938 if t.previewed.wipe && t.previewed.version != t.previewer.version {1939 t.previewed.wipe = false1940 t.pwindow.Erase()1941 } else if unchanged {1942 t.pwindow.MoveAndClear(0, 0) // Clear scroll offset display1943 } else {
85 unmodified lines
2029 isSixel := strings.HasPrefix(passThrough, "\x1bP")2030 if isSixel {2031 t.previewed.wipe = true2032 if t.termSize.PxHeight > 0 {2032 rows := util.Max(0, strings.Count(passThrough, "-")-1)2033 requiredLines = int(math.Ceil(float64(rows*6*t.termSize.Lines) / float64(t.termSize.PxHeight)))2033 rows := strings.Count(passThrough, "-")2034 requiredLines = int(math.Floor(float64(rows*6*t.termSize.Lines) / float64(t.termSize.PxHeight)))2035 }2036 }20372038 // Render wireframe when Sixel image cannot be displayed entirely
129 unmodified lines
2168 t.renderPreviewSpinner()2169 t.previewed.numLines = numLines2170 t.previewed.version = t.previewer.version2171 t.previewed.offset = t.previewer.offset2171 t.previewed.wipe = false2172}21732174func (t *Terminal) printPreviewDelayed() {2175 if !t.hasPreviewWindow() || len(t.previewer.lines) > 0 && t.previewed.version == t.previewer.version {
1822 unmodified lines