Make sixel output flicker free (#1943)

* Make sixel output flicker free

* Address pr comments

* Lock regions based on sixel dimensions

This fixes issues related to clearing the previous sixel data

* name changes and extra error handeling

* Apply force clearing changes and change log messages

* Delete missleading comment

* check pixel dimensions

* correct cell dimensions checking

* Add force clearing on image update

---------

Co-authored-by: Mariusz Kuchta <mariusz@kuchta.dev>
This commit is contained in:
KuchteqandMariusz Kuchta authored and GitHub committed 2025-04-28 12:26:27 +10:00
1 parent 3d205f05e3
commit 7a89808688
6 files changed
+71 -64

No files matched your search

+7 -10
View File
@@ -1020,7 +1020,6 @@ func (ui *ui) draw(nav *nav) {
context := dirContext{selections: nav.selections, saves: nav.saves, tags: nav.tags}
ui.screen.Clear()
ui.sxScreen.sixel = nil
ui.drawPromptLine(nav)
@@ -1058,14 +1057,15 @@ func (ui *ui) draw(nav *nav) {
ui.screen.ShowCursor(ui.msgWin.x+runeSliceWidth(prefix)+runeSliceWidth(left), ui.msgWin.y)
}
if gOpts.preview {
curr, err := nav.currFile()
if err == nil {
preview := ui.wins[len(ui.wins)-1]
curr, err := nav.currFile()
if err == nil {
preview := ui.wins[len(ui.wins)-1]
ui.sxScreen.clearSixel(preview, ui.screen, curr.path)
if gOpts.preview {
if curr.Mode().IsRegular() || (curr.IsDir() && gOpts.dirpreviews) {
preview.printReg(ui.screen, ui.regPrev, nav.previewLoading, &ui.sxScreen)
} else if curr.IsDir() {
ui.sxScreen.lastFile = ""
preview.printDir(ui, ui.dirPrev, &context,
&dirStyle{colors: ui.styles, icons: ui.icons, role: Preview})
}
@@ -1097,10 +1097,6 @@ func (ui *ui) draw(nav *nav) {
}
ui.screen.Show()
if ui.menu == "" && ui.cmdPrefix == "" && ui.sxScreen.sixel != nil {
ui.sxScreen.lastFile = ui.regPrev.path
ui.sxScreen.showSixels()
}
}
func findBinds(keys map[string]expr, prefix string) (binds map[string]expr, ok bool) {
@@ -1522,6 +1518,7 @@ func (ui *ui) readExpr() {
}
func (ui *ui) suspend() error {
ui.sxScreen.forceClear = true
return ui.screen.Suspend()
}