Skip to content
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

fix: cursor behavior on link insertion #48

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

taeruh
Copy link
Contributor

@taeruh taeruh commented Jan 13, 2024

Hi; this PR fixes the cursor behavior when users had some of the keys remapped that where fed via nvim_feedkeys. It should also fix #37.

However, note that to do this I basically changed nvim_feedkeys("hf]a", "t") to nvim_feekeys("a", "n"). Why was "hf]" there in the first place; shouldn't nvim_put("...", false, true) place the cursor at the end of the inserted text anyways, or am I'm missing some edge cases here? I'm a little bit uncertain about that.

Additionally, the behavior is changed such that insert mode is only entered if the action was started from insert mode, and the putting behaves like p instead of P. The latter change is debatable, but for me at least, it felt more natural that way; if you think differently I'll change it back.

- use `feedkeys` with mode "n" instead of "t" -> more robust against
  user remaps
- only go into insert mode when executed from insert mode
- make `put` behave like `p` and not `P`
@max397574
Copy link
Collaborator

@vhyrro can you take a look at this since you initially wrote that function?
looks good from my side

@vhyrro
Copy link
Member

vhyrro commented Apr 4, 2024

Sorry for taking this long. Looks good to me!

@vhyrro vhyrro merged commit 2fb1177 into nvim-neorg:main Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra characters on inserting link
3 participants