Closed tristan-harris closed 3 months ago
This is a side effect of what a debounce means and differences in user behavior will make the lag better or worse.
A debounce means run this function if at least n
milliseconds have passed since the last run. So repeatedly triggering the function will skip most executions. There's a neat doc that goes over different techniques: https://gist.github.com/runiq/31aa5c4bf00f8e0843cd267880117201#debouncing-on-the-leading-edge.
So a debounce of 100 milliseconds will update the marks in the view port and any events that occurs faster than 100 milliseconds get ignored. Moving down by holding j
is going to be one of the worst cases since those events occur at nearly the same time. So the update only happens after j
stops being held and the CursorHold
event triggers.
I think I can do something to improve this by treating movements differently from text changes, and skip the debounce if we don't need to parse the document.
I've pushed a change to avoid debounce / parsing on cursor movements, should improve the lag: https://github.com/MeanderingProgrammer/markdown.nvim/commit/6bb1d43c9e360929d4497a0459084b062bfe9de5.
LMK if it works better after the update!
Wow, fastest developer on Github! Everything works great.
Now I can happily continue spamming h
/j
instead of learning proper Vim motions 😃.
Neovim version (nvim -v)
0.10.1
Operating system
Arch Linux
Terminal emulator / GUI
Alacritty
Describe the bug
There is a noticeable delay between moving the cursor off a line and the marks on that line being updated. This can be solved by setting
debounce = 0
, but should not be necessary given that the default is only 100 milliseconds.https://github.com/user-attachments/assets/800201fc-56f6-4d1e-bd79-10f086b6b955
Expected behavior
The marks on a line update near instantly when the cursor is move elsewhere.
Healthcheck output
Plugin configuration
Confirmations
Additional information
Markdown text used in recording.