preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.09k stars 484 forks source link

Bug: Tagbar seems to be "one tag too late" when updating statusline #855

Open charleshwankong opened 11 months ago

charleshwankong commented 11 months ago

I use the following mappings to perform navigation in the bug demo below.

nnoremap <space> /^    p.*(.*<CR>:nohl<CR><ESC>
nnoremap <leader><space> ?^    p.*(.*<CR>:nohl<CR><ESC>

https://github.com/preservim/tagbar/assets/28559561/f9f74222-94c5-49c6-81ba-065e641b0f44

Expected behavior is that upon each jump performed, the statusline should be updated to display the function name arrived at.

Actual behavior is seen in the screenshot. My interpretation of it is that expected behavior occurs about only 10% of the time. 90% of the time, the statusline displays the prior function rather than the current function.

Other details.

  1. Any time the statusline is late, any movement within the function (in the screenshot, I use '$' to go to end of line, or use which is just a trivial mapping I have to run nohighlight.) will update the statusline to the correct value 100% of the time.
  2. I don't believe this is a latency issue as some other issues have been suggesting, because tagbar responds quickly to the jumps in the screenshot. The "delay" is instead in what function tagbar thinks it's currently in.
raven42 commented 11 months ago

Can you share your vimrc configuration? I'm trying to reproduce and for me it updates almost instantaneously.

tagbar-jump-to-tag

One possibility is if you have your updatetime in vim set too high. By default I believe this is 4000 (4 seconds). Can you try setting this to 500 and see if you see a change in behavior?

Add the following in your .vimrc

set updatetime=500