-
Notifications
You must be signed in to change notification settings - Fork 332
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
Refresh preview even if selection doesn't change #1074
Conversation
@laktak, I think you last changed this code. Any concerns about this PR? |
Haven't tested it but it looks reasonable. |
It shouldn't be too hard to setup image previews. I was able to reproduce the issue by following the instructions in the wiki, which is just creating a few shell scripts and ensuring If anyone does have image previews setup already, I would appreciate it if they could verify that this patch works for them and not just myself. |
I've tested it. It works for me |
I see issues when moving window from screen to screen in dwm with ctpv (I think only ctpv has this issue but it worked fine before r28). Unlike in current behavior, it is not updated when moving focus up or down and all other images are affected. There are issues even when moving in the same size tile as it had before the move. |
@DusanLesan Sorry I didn't quite understand - when you say that you're having issues, are you referring to version r28 or my patch? I don't use ctpv myself, but if you still have issues then you can try to see when the previewer and cleaner are being called, by making them shell scripts which write to a log file before invoking |
@joelim-work Sorry, my bad. I checked out your patch and saw this issue. Later I didn't manage to reproduce it on the main branch. But ctpv issue is not new and I have now seen it on the main too. |
In my case, the image previews were working fine up to version r27, but then after upgrading to r28 they now have issues refreshing properly. However after making this change, this issue doesn't happen anymore, at least not for me 😃. What should happen normally is that the
These are then eventually picked up in the
The problem in r28 is that the @DusanLesan If you want to get to the bottom of your issue (again I'm not sure if it's caused by --- a/nav.go
+++ b/nav.go
@@ -644,6 +644,7 @@ func (nav *nav) previewLoop(ui *ui) {
if clear && len(gOpts.previewer) != 0 && len(gOpts.cleaner) != 0 && nav.volatilePreview {
nav.exportFiles()
exportOpts()
+ log.Printf("cleaning: %s", prev)
cmd := exec.Command(gOpts.cleaner, prev,
strconv.Itoa(win.w),
strconv.Itoa(win.h),
@@ -749,6 +750,7 @@ func (nav *nav) preview(path string, win *win) {
if len(gOpts.previewer) != 0 {
nav.exportFiles()
exportOpts()
+ log.Printf("previewing: %s", path)
cmd := exec.Command(gOpts.previewer, path,
strconv.Itoa(win.w),
strconv.Itoa(win.h), |
@joelim-work Looks like ctpv issue. In this code everything looks to be sent as expected. If I open lf on second screen I get the same preview parameters like when I open on the first screen and then move to second. |
Thinking out loud: I wonder whether this PR also helps with #914. I don't have a very good understanding of that issue, though. |
@ilyagr I commented on that issue in regards to what I think is happening, see #914 (comment) I'm quite sure it's a separate issue - this pull request is about the previewer/cleaner not being invoked, whereas #914 is caused by the directory cache being stale (the default directory preview doesn't invoke the previewer/cleaner anyway). |
Your theory in that bug sounds very reasonable. Thank you so much for investigating it! |
Fixes #1055
The
loadFile
function is responsible for refreshing the preview, which should happen even if the selected file hasn't changed (e.g. if the terminal is resized or if a shell command is run). I believe this is a bug that was accidentally introduced when adding theon-select
command.