beacon.nvim icon indicating copy to clipboard operation
beacon.nvim copied to clipboard

Quickly switching buffers can break the animation

Open DanCardin opened this issue 4 years ago • 5 comments

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:

  • the visual indicator to not show up at all on the final buffer you land on
  • the visual indicator to remain visible until some other key is pressed

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

DanCardin avatar Jun 25 '20 16:06 DanCardin

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 avatar Jun 25 '20 17:06 DanilaMihailov

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 :)

DanilaMihailov avatar Jun 26 '20 05:06 DanilaMihailov

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?

DanCardin avatar Jun 26 '20 20:06 DanCardin

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 avatar Jun 27 '20 05:06 DanilaMihailov

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.

DanilaMihailov avatar Jul 01 '20 12:07 DanilaMihailov