-
Notifications
You must be signed in to change notification settings - Fork 49
bug: plugin changes j/k behavior #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
## Details Issue: #186 In order to fix #177 the window option setting logic was updated to always modify window options rather than on a state transition. The reason was to handle out of band state transitions for a buffer that would cause the state of the window options to be changed without the inner states knowledge. As a result the window options were not being properly updated since effectively no state transition occured. While this does seem to have almost no performance penalty it does seem to reset some kind of state in neovim that causes some kinds of motions to be have differently, such as moving between ends of lines as reported in the issue. To fix this rather than always updating the option value, get the current value and only set the new value if it is different. In this way we properly handle out of band transitions since we're relying on the actual current option value and not some internal state. And since we don't unnecessarily change the value we don't mess with any internal neovim state and allow motions to behave as they normally would.
Thanks for reporting this! At first I thought there was no way it was due to this plugin since we don't track any kind of column state or touch motions at all. But after disabling the plugin and trying a few things it was definitely something I was doing. Turned out to be related to the constant setting of window local options. While setting the values doesn't seem to have a noticeable performance penalty and I figured internally neovim would do nothing if we were reseting the same value, that did not appear to be the case. There could be a very good reason to still do some work when setting an option even if it's the same value and something about that messed with this column state. Fix was pretty simple on my end and the plugin now checks if the value being set is different than the current value: 91ce0b5 LMK if it works on your end! |
Yeah hah, I really did not expect it to be coming from this plugin when I was doing the ol "disable plugins one by one and see where it's coming from" search. Went digging in the plugin code to see where it might be coming from and didn't find any likely culprits, either. But dang, window local options side effects, now that wouldn't have been my first, second, or third guess — that is some impressive sleuthing on your end. Fix works like a charm 💫. Thank you! |
Neovim version (nvim -v)
0.10.1
Neovim distribution
N/A
Operating system
MacOS
Terminal emulator / GUI
kitty
Describe the bug
The plugin changes the behavior of the
j
andk
normal mode movements.$
; the behavior is as expected if$
is used, weirdly)If the long line is length
X
and the short line is lengthY
, the cursor will be at columnY
of the long line, rather than at columnX
as expected. In other words, j and k are not inverses.A more visual explanation:
If the buffer contains the following text, and the cursor is on the character surrounded by brackets:
press
k
press
j
In other words, the plugin "column memory" of j/k is getting messed with
Expected behavior
start:
press
k
press
j
Healthcheck output
render-markdown: require("render-markdown.health").check()
render-markdown.nvim [version] ~
render-markdown.nvim [configuration] ~
render-markdown.nvim [nvim-treesitter] ~
render-markdown.nvim [executables] ~
render-markdown.nvim [conflicts] ~
Plugin configuration
Reproducible with no configuration
Plugin error log
N/A
Confirmations
Additional information
No response
The text was updated successfully, but these errors were encountered: