Skip to content

Commit cdbaa97

Browse files
authored
fix: reset sixel state if new file is loading (gokcehan#2301)
* fix: reset sixel state if new file is loading * Update `CHANGELOG.md`
1 parent 4575ed0 commit cdbaa97

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
88
- `Added`
99
- `Fixed`
1010

11+
## r41 (Unreleased)
12+
13+
### Fixed
14+
15+
- A bug where sixel images fail to display when scrolling back and forth is now fixed (#2301).
16+
1117
## [r40](https://github.com/gokcehan/lf/releases/tag/r40)
1218

1319
### Fixed

sixel.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ func (sxs *sixelScreen) printSixel(win *win, screen tcell.Screen, reg *reg) {
2828
return
2929
}
3030

31-
if !reg.sixel {
32-
sxs.lastFile = ""
33-
return
34-
}
35-
3631
cw, ch, err := cellSize(screen)
3732
if err != nil {
3833
log.Printf("sixel: %s", err)

ui.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ func (win *win) printRight(screen tcell.Screen, y int, st tcell.Style, s string)
244244
}
245245

246246
func (win *win) printReg(screen tcell.Screen, reg *reg, previewLoading bool, sxs *sixelScreen) {
247-
if reg.loading {
247+
switch {
248+
case reg.loading:
248249
if previewLoading {
249250
st := tcell.StyleDefault.Reverse(true)
250251
win.print(screen, 2, 0, st, "loading...")
251252
}
252-
return
253-
}
254-
255-
if !reg.sixel {
253+
case reg.sixel:
254+
sxs.printSixel(win, screen, reg)
255+
default:
256256
st := tcell.StyleDefault
257257
for i, l := range reg.lines {
258258
if i > win.h-1 {
@@ -263,7 +263,9 @@ func (win *win) printReg(screen tcell.Screen, reg *reg, previewLoading bool, sxs
263263
}
264264
}
265265

266-
sxs.printSixel(win, screen, reg)
266+
if !reg.sixel {
267+
sxs.lastFile = ""
268+
}
267269
}
268270

269271
var gThisYear = time.Now().Year()

0 commit comments

Comments
 (0)