Skip to content

Conversation

@chrisgrieser
Copy link
Contributor

Description

when used in insert mode, the put action, by default used by the icon source, always moves the cursor to the end of the line instead of the end of the pasted text.

The issue arises since :startinsert! (with bang) behaves like A, not like a. Since nvim_paste moves the cursor onto the last pasted character, we need a to correctly position the cursor when re-entering insert mode. However, :startinsert behaves like i and :startinsert! like A, so we need to check whether we are at the end of the line to determine whether we emulate il or A for correct cursor positioning.

Whether we are at the end of the line cannot simply be determined with nvim_win_get_cursor and nvim_get_current_line, since emojis/nerdfonts affect the string length. Instead of convoluted string width calculations, using fn.virtcol is simpler and also does the job.

@github-actions github-actions bot added the size/m Medium PR (<50 lines changed) label Nov 16, 2025
@chrisgrieser chrisgrieser changed the title fix: put action always moving cursor to the EoL fix(picker.actions): put action always moving cursor to the EoL Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

picker size/m Medium PR (<50 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant