Skip to content

Don't redraw volatile previews on ticker period#546

Merged
gokcehan merged 1 commit into
gokcehan:masterfrom
neeshy:master
Jan 4, 2021
Merged

Don't redraw volatile previews on ticker period#546
gokcehan merged 1 commit into
gokcehan:masterfrom
neeshy:master

Conversation

@neeshy

@neeshy neeshy commented Dec 29, 2020

Copy link
Copy Markdown
Contributor

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

@gokcehan

gokcehan commented Jan 2, 2021

Copy link
Copy Markdown
Owner

@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

neeshy commented Jan 3, 2021

Copy link
Copy Markdown
Contributor Author

@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

gokcehan commented Jan 4, 2021

Copy link
Copy Markdown
Owner

@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