neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.48k stars 118 forks source link

Non deterministic behavior? #483

Closed pierreganty closed 3 years ago

pierreganty commented 3 years ago

Unless I am mistaken I would expect that from normal mode, switching to operator pending mode with d consistently goes to the same state. Here you can see that the first time with d it goes to no mode, then with dv it goes to nov mode, but finally with d it goes again to nov mode while I expect it to go to no mode again.

>>> import neovim
>>> n = neovim.attach("child", argv=['/opt/homebrew/bin/nvim', "
--clean", "--embed", "--headless"])
>>> n.input("d")
1
>>> n.api.get_mode()
{'mode': 'no', 'blocking': False}
>>> n.input("<esc>")
5
>>> n.api.get_mode()
{'mode': 'n', 'blocking': False}
>>> n.input("d")
1
>>> n.api.get_mode()
{'mode': 'no', 'blocking': False}
>>> n.input("<esc>")
5
>>> n.api.get_mode()
{'mode': 'n', 'blocking': False}
>>> n.input("dv")
2
>>> n.api.get_mode()
{'mode': 'nov', 'blocking': False}
>>> n.input("<esc>")
5
>>> n.api.get_mode()
{'mode': 'n', 'blocking': False}
>>> n.input("d")
1
>>> n.api.get_mode()
{'mode': 'nov', 'blocking': False}
>>>
pierreganty commented 3 years ago

I could reproduce the behavior all the way up to vim. See https://github.com/vim/vim/issues/8323 details.

pierreganty commented 3 years ago

fixed in https://github.com/vim/vim/commit/21492743e80c6740bac65a91311c28bede8ef2f8