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

lf image preview flickering #1738

Open
youpilai opened this issue Jun 3, 2024 · 5 comments
Open

lf image preview flickering #1738

youpilai opened this issue Jun 3, 2024 · 5 comments

Comments

@youpilai
Copy link

youpilai commented Jun 3, 2024

Hi,

Similar to closed issue #1689 , image is flickering when loaded, when swapping workspace, when copy, cut or paste
I tried to put an echo command in my preview script, but it is not triggered multiple time, only when changing the file to be previewed (moving up and down)
I tested with minimal lfrc and preview files to see if it was in my config with no difference

the command used to preview images is the commonly used :
chafa -f sixel -s "$2x$3" --animate off --polite on "$1"

lf -version = r32 (32-1)
chafa --version = 1.14.0
foot -v = 1.17.2 +pgo +ime +graphemes -assertions

Edit : i just saw #1665 : i tried with and without "set period 1" with no difference. In my case the image flicker only once when loaded for the first time or when an action is done : copy/cut/paste

@Kuchteq
Copy link

Kuchteq commented Jun 5, 2024

Facing similar issue. Went back to version 31-1 to test if it has always been the case but there there's no flicker

@joelim-work
Copy link
Collaborator

Hi, it looks like the issue is because some time after version r31, the tcell dependency was upgraded, and is no longer compatible with the original Sixel implementation. I tried to rewrite the code in #1744, would you be able to try it out and see if there's an improvement with the flickering?

Hopefully it works, but if not then I'm not sure what can be done.

@youpilai
Copy link
Author

youpilai commented Jun 6, 2024

it seems to be working for me, there is no longer flickering when previewing images (moving up and down through files in lf), nor when swapping workspace

there is still a flickering when performing an action (copy/cut) on a file, but it can be seen as a visual hint that you performed the action

Nice and quick work, i'll keep my local version until this commit merge to master

Edit: in fact, when in full screen, the flickering is still present, but less than before, and sometimes the previous is not cleaned (if the new preview is smaller than the previous, you'll see a part of the latter remaining)

@joelim-work
Copy link
Collaborator

Interestingly I couldn't reproduce most of the above when I tried using foot just now, but that was with the default settings without any configuration, since I don't actually use that terminal. But very occasionally I do see random things like flickering, part of the preview not being cleaned up properly, artefacts when resizing the terminal, etc.

I think it might not be feasible to fix every Sixel-related issue though. While there is an escape sequence for writing Sixel images, cleaning them up is implemented by setting the value of each cell in the preview window to a blank character, and it may not work reliably depending on which terminal you use.

As for the PR, I might leave it open for a while to get more feedback, especially on the actual changes to the code. I will consider merging it if the overall experience is improved, but I also don't expect it to be perfect.

@youpilai
Copy link
Author

youpilai commented Jun 6, 2024

after some use, it appears the cleaning problem is just on the first load of an image taller than the next one (i don't use cache for thumbnails, they are created on the fly via chafa)

Anyway, for now it is absolutely usable to me, i'll keep the locally patched version and wait to see if it's merged one day

Thanks

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

No branches or pull requests

3 participants