thimc / lfimg

Image preview support for lf (list files) using Überzug
GNU General Public License v3.0
253 stars 45 forks source link

Image stay after select new files #1

Closed Cyberdr3am closed 4 years ago

Cyberdr3am commented 4 years ago

Hi,

When i change to new image i can see it without problem. When i whant to see old image, the old one stay and i can't the the new image.

Same with video preview, when i come back to old video, the last one stay on screen

The last is clear but i can't show image i already see

thimc commented 4 years ago

This is a known issue and is currently resolved by using the reload command in lf. I haven't had the time lately to implement a function that will solve this unexpected behavior. Feel free to make a pull request if you have time over and a fix.

mvrozanti commented 4 years ago

I too am having this problem.

I haven't had the time lately to implement a function that will solve this unexpected behavior.

Are we able to detect it programatically? Do you know how?

Maybe this issue should be reopened, since it was never fixed.

reinzanini commented 4 years ago

yeah i don't get, it it isn't fixed the issue should remain open

x41lakazam commented 4 years ago

Hi, I didn't really fixed it, but at least the "reload" is automatic Here is the patch: 61f80c8d78df4a518c2995097a21b24c5a4b39ea

BurnyBoi commented 3 years ago

This is actually a symptom of lf not calling the previewer script each time a file is navigated to. It seems to be doing some caching where once it's previewed a file for that session, it doesn't call the previewer script for that file again, thus causing the image to never be re-drawn.

I filed a bug on lf to see if we can get this caching behavior changed. The steps for proving what I stated above are listed there. If we can, this issue will be indirectly resolved as a result: https://github.com/gokcehan/lf/issues/521

neeshy commented 3 years ago

I've patched lf so that previews are generated on every file selection change. Here: https://github.com/gokcehan/lf/pull/522. You just have to add set nopreviewcache to your lfrc.

neeshy commented 3 years ago

Apparently the desired behavior is already implemented much better in lfp (https://gitlab.com/Provessor/lfp). You should use that instead. With lfp, as long as the preview script returns a non-zero exit code, the given file's preview (and only that file's preview) will be regenerated the next time it is selected. I've closed my PR after realizing this.

codedmart commented 3 years ago

I am not sure I understand how to clear the image properly. I have tried set nopreviewcache true. And I have also tried lfp, but still images stay after selecting new files.

neeshy commented 3 years ago

@codedmart Just to be clear, you don't need to have set nopreviewcache in your lfrc if you're using https://gitlab.com/Provessor/lfp. That was just for https://github.com/gokcehan/lf/pull/522. If you're using lfp, you'll need to create a cleaner script which sends ueberzug a command to clear the screen.

I've created a repo at https://github.com/neeshy/lfimg which is intended to be used with https://github.com/neeshy/lf. There, you'll find example scripts for a lf + ueberzug setup with image clearing.

codedmart commented 3 years ago

@neeshy I tried your repo and have tried lfp both with cleaner scripts yet I still see the problem of images sticking or previews only showing the first time I select a file.

The images stick while I browse other folders. It I select another file I do tend to see the new preview. But if I go back to a file I have already previewed it doesn’t show the preview for that file again.

neeshy commented 3 years ago

@codedmart Did you make sure that your previewer script exits with a non-zero exit code when generating image previews? It sounds like that's the problem. BTW, this feature was just merged into upstream lf, so you can use that instead of a fork. Here's some documentation: https://github.com/gokcehan/lf/wiki/Previews