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 doesn't call preview script again after a file has been previewed #521

Closed
BurnyBoi opened this issue Dec 5, 2020 · 3 comments
Closed

Comments

@BurnyBoi
Copy link

BurnyBoi commented Dec 5, 2020

I noticed this while testing why the lfimg project has the issue where after you've previewed a media file, if you navigate to that file again, it doesn't draw its preview again. The reason is that lf doesn't ever call the user's previewer script after it has called it for a file once during the lf session.

Steps to reproduce

  1. Add echo "previewing $1" >> /tmp/testing.log to your previewer script so it is called on every file that is previewed
  2. Run tail --follow /tmp/testing.log to watch the file as it updates
  3. Open lf in a directory with files to be previewed, and navigate to each file. You'll see output in testing.log for each file.
  4. Now, navigate back up to the files you already previewed.

What you'll see is that although lf is able to preview the text files, it never calls the previewer script again (you can tell because your tail command won't give any more output), so if you're using lfimg to preview media, they won't be drawn again. lf seems to be caching the text previews for files, and displaying the cached version rather than calling the previewer script each time.

Basically, the media file previews in the lfimg project would work perfectly if lf was changed to always call the previewer script every time, and stop doing caching. Is there a way to give the user control over this so we can get media previews working better? For reference, this is what I'm referring to: https://github.com/cirala/lfimg

@neeshy
Copy link
Contributor

neeshy commented Dec 5, 2020

This intended behavior as far as I know. That being said, I added an option to disable this in #522

@neeshy
Copy link
Contributor

neeshy commented Dec 6, 2020

I looked into it and as mentioned on #522, lfp (https://gitlab.com/Provessor/lfp) already implements this desired behavior. As long as the preview script returns a non-zero exit code the given file's preview will be regenerated the next time it is selected.

@neeshy
Copy link
Contributor

neeshy commented Jan 19, 2021

This has been implemented in #531

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