-
Notifications
You must be signed in to change notification settings - Fork 212
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
fix: defer execution to avoid segfaults and fix throttler #526
Conversation
@@ -165,7 +167,6 @@ function M.enable() | |||
|
|||
if config.multiwindow then | |||
table.insert(update_events, 'WinResized') | |||
table.insert(update_events, 'WinLeave') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't recall why I used this event for multi-window support. It appears to be unnecessary because it triggers for the window being left (nvim_get_current_win() returns the window that the user is leaving).
1d8a3a7
to
b50f8db
Compare
01ca79f
to
6307099
Compare
6307099
to
3ba5d0c
Compare
@@ -15,25 +15,52 @@ local all_contexts = {} | |||
--- @param ms? number | |||
--- @return F | |||
local function throttle_by_id(f, ms) | |||
ms = ms or 200 | |||
ms = ms or 150 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is have decreased throttle timeout a little to compensate previous incorrect behavior.
Should fix #522 reliably.
It is inspired by the satellite.nvim plugin https://github.com/lewis6991/satellite.nvim/blob/main/lua/satellite.lua#L74, which is more stable and consistently uses deferred execution. In contrast, the current implementation sometimes uses deferred execution and other times executes callbacks in-place, when they are not throttled.
Also, there was a problem with throttler, the following execution was possible: