DanilaMihailov / beacon.nvim

Whenever cursor jumps some distance or moves between windows, it will flash so you can see where it is
339 stars 9 forks source link

Quickly switching buffers can break the animation #2

Open DanCardin opened 4 years ago

DanCardin commented 4 years ago

I've got bprev and bnext bound with <leader> mappings which make it pretty easy to chain them together more quickly than the animation can finish.

It seems like, depending on timing, I can get:

(neither of these are particularly significant to me, just figured I'd mention it, great plugin!)

DanilaMihailov commented 4 years ago

the visual indicator to remain visible until some other key is pressed

I think it is just how Vim works. I use timer_start() for animation and it says in docs "When the system is busy or Vim is not waiting for input the time will be longer." so when you press other keys, Vim is waiting for your key combination to finish and blocks everything else, thats what beacon is not hiding in time.

the visual indicator to not show up at all on the final buffer you land on

Maybe it is the same problem with timer_start(), I do see it myself sometimes.

I think there is few ways I can get around this limitations, and it should make animations more robust. I will look into it.

Thanks for feedback :) I'll keep this issue open, until I figure out a way to make animations better.

DanilaMihailov commented 4 years ago

the visual indicator to not show up at all on the final buffer you land on

I think I fixed this in a new release, there was timer I forgot to clear :)

DanCardin commented 4 years ago

I agree, I think this fixed the not showing up at all bit.

And I figured out how to easily repro the "bug" where it stays: My leader is <space>, so I make a big move then hit space while it's animating.

EDIT: Actually, I guess this is sort of what you said originally. Though I suppose I'd expect the indicator to still eventually disappear after the leader input times out?

DanilaMihailov commented 4 years ago

Though I suppose I'd expect the indicator to still eventually disappear after the leader input times out?

Good point. Just checked, it disappears for me. I do 11j<space> and see indicator freeze, but after around a second it disappears. But if I do 11j<C-w> it just stays forever waiting for next key.

I actually trying to support vim8 now and I don't see this problem there. I guess it's neovim only behaviour. I hope I can fix it by using jobs.

DanilaMihailov commented 4 years ago

So it seems to be neovim bug, when neovim is in operator-pending mode (waiting for user to finish key combination) it stops all timer callbacks (and jobs too), until the end of operator-pending mode. I don't see how I can fix it now.

There is relevant neovim issue https://github.com/neovim/neovim/issues/7350.