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

Allow the WinResize hook to be called farther apart in time from the last callback #673

Open
lenormf opened this issue May 12, 2016 · 1 comment

Comments

@lenormf
Copy link
Contributor

lenormf commented May 12, 2016

Hi,

I noticed that the WinResize hook will be called every single time the window is resized, which can be a lot of times when I resize my terminal for like 1s.

This makes a lot of unecessary calls to callbacks that probably don't really need that much accuracy, and would rather be called -say- every 1 full second. E.g. refreshing the *doclist*buffer when a manpage is open.

How about letting users specify a delay between two callbacks when the hook is set, so that we can avoid that ?

hook global WinResize 1.0 %{ … }

The above line would wait for at least 1.0 second between two calls to the actual code.

Thanks.

@lenormf
Copy link
Contributor Author

lenormf commented May 14, 2016

After discussing this on IRC, a way to fix this would be to have a scoped timer command.

hook window WinResize .* %{ timer -id ManPageResize window %{ manpage_resize } }

Calling the same timer several times would only overwrite the timer previously declared with the same id.

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

No branches or pull requests

1 participant