Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"set period 1" causes flickering in sixel image previews #1665

Closed
Zerogaku opened this issue Mar 30, 2024 · 2 comments · Fixed by #1666
Closed

"set period 1" causes flickering in sixel image previews #1665

Zerogaku opened this issue Mar 30, 2024 · 2 comments · Fixed by #1666

Comments

@Zerogaku
Copy link

From bakkeby/st-flexipatch#128, set period 1 causes flickering on images previews, removing that line from lfrc fixes it.

output.mp4
@joelim-work
Copy link
Collaborator

I'm not sure whether it's possible to prevent flickering when redrawing the same image in the same spot. TUI libraries like tcell typically maintain an internal buffer which stores the contents of the screen before flushing them to the actual terminal. As only changes in the internal buffer are flushed, this makes the actual updates appear more smooth.

The problem is that terminals don't truly have a concept of displaying images, and hacky standards like Sixel graphics are only made possible by bypassing the internal buffer and writing directly to the terminal. When you consider the steps that lf uses to draw the UI, it makes sense that there is a flicker:

  1. lf clears the screen (really the internal buffer) to draw everything from scratch
  2. Various components (pane, prompt, status bar, etc.) are drawn to the internal buffer. This includes previews that are text-based and not images
  3. The internal buffer is flushed to the terminal (this will wipe the existing image preview)
  4. If sixel is enabled, the sixel image is drawn by writing it to the terminal

That being said, specifically for the period timer, I think there is no need to redraw the UI since the purpose is to just check if any files have been modified, which essentially happens in the background.

@joelim-work
Copy link
Collaborator

I have submitted #1666 to address this, hopefully it fixes the issue for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants