vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong #25569
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.
vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong
Problem: cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
commas
Fix command-line expansions for options with filenames with commas
Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in
copy_option_part()duringoption parsing.
Fix as follows:
names will not start a new match when seeing
\\,and will insteadconsider it as one value.
\\when seeing\\,tomake sure it can match the correct files/folders.
,with\\,, similar to how spacesare escaped to make sure the option value is correct on the cmdline.
This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing ',' for a file name results in it
being handled literally but in other platforms ',' is interpreted as a
simple ',' and commas need to be escaped using '\,' instead.
Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=' and regular ex
commands like
:edit <Tab>do not require escaping and will continue towork.
Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.
closes: vim/vim#13303
related: vim/vim#13301
vim/vim@5484485
Co-authored-by: Yee Cheng Chin [email protected]