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

Don't redraw volatile previews on ticker period #546

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Don't redraw volatile previews on ticker period #546

merged 1 commit into from
Jan 4, 2021

Conversation

neeshy
Copy link
Contributor

@neeshy neeshy commented Dec 29, 2020

Fixes #542
There's probably a more elegant solution to this though.

@gokcehan
Copy link
Owner

gokcehan commented Jan 2, 2021

@neeshy Thanks for the solution. Would it not be possible to simply add a conditional to the ticker since it is only different in a single place? Something like:

diff --git a/app.go b/app.go
index 611292d..2905fca 100644
--- a/app.go
+++ b/app.go
@@ -352,7 +352,9 @@ func (app *app) loop() {
                        app.ui.draw(app.nav)
                case <-app.ticker.C:
                        app.nav.renew()
-                       app.ui.loadFile(app.nav)
+                       if !app.nav.volatilePreview {
+                               app.ui.loadFile(app.nav)
+                       }
                        app.ui.draw(app.nav)
                }
        }

This seems to work with the non-caching version of my preview highlight script. I don't have an image setup yet so I'm not sure if it works.

@neeshy
Copy link
Contributor Author

neeshy commented Jan 3, 2021

@gokcehan The problem with that patch is that the preview won't be regenerated when the modification time changes. So, disabling calling the ui.loadFile method altogether isn't sufficient. Somehow the call to nav.checkReg has to be retained, which my patch does.

@gokcehan
Copy link
Owner

gokcehan commented Jan 4, 2021

@neeshy Ah, I see, don't mind me, I will just merge this patch then, thanks.

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 this pull request may close these issues.

bug: when period option is not 0 image preview gets cleared and redrawn
2 participants