Conversation
Input handlers with their own window (ui.input.use_vim_ui) leave visual mode before the prompt is answered, so the selection was gone by the time the description was picked. Now captured while the mapping still runs. Linewise and blockwise work too (the old check only matched 'v'). Multi-line selections stay ignored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
ui.input.use_vim_ui = trueand an input handler that opens its own window, inserting a link over a visual selection ignores the selection.alpha beta gamma, selectbeta.<prefix>liand pickhttps://example.com.alpha beta[[https://example.com]] gammainstead ofalpha [[https://example.com][beta]] gamma.Such handlers leave visual mode before the user answers the prompt, and
OrgLinks:insert_linkreadsvim.fn.mode()only after the input promise resolves. The cmdline prompt keeps visual mode, so the default configuration never shows the bug. That is also why the test stubsvim.ui.inputwith a float.OrgMappings:insert_linknow captures the selection before the prompt opens. Linewise selections failed on the cmdline prompt too, because the old check only matched'v'andgetregionwithouttypereturned one character forV.The selection now wins over the link target as description. Before,
descfell back to the target first, so the prompt offered the headline title instead of the selected text. I think the selection is the more explicit intent.Multi-line selections still fall back to cursor insert, since the insert path works on a single line.
I removed
utils.get_visual_selection. Its only caller was the line replaced here.