diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-10 09:15:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 09:15:21 +0800 |
commit | c40a1c0f41ad2557b1e1e1850244eca2d895a07d (patch) | |
tree | 9e6b702ab900d24e4ff949e363a03703ffe36c28 /runtime/lua/vim/_meta/options.lua | |
parent | f5eabaa9407ae3d1ccf6592337453c423eff3d9a (diff) | |
download | rneovim-c40a1c0f41ad2557b1e1e1850244eca2d895a07d.tar.gz rneovim-c40a1c0f41ad2557b1e1e1850244eca2d895a07d.tar.bz2 rneovim-c40a1c0f41ad2557b1e1e1850244eca2d895a07d.zip |
vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong (#25569)
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()` during
option parsing.
Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
names will not start a new match when seeing `\\,` and will instead
consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
are 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=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.
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
https://github.com/vim/vim/commit/54844857fd6933fa4f6678e47610c4b9c9f7a091
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
-rw-r--r-- | runtime/lua/vim/_meta/options.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 4f6408b136..a4e0e61248 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6877,8 +6877,8 @@ vim.go.tagrelative = vim.o.tagrelative vim.go.tr = vim.go.tagrelative --- Filenames for the tag command, separated by spaces or commas. To ---- include a space or comma in a file name, precede it with a backslash ---- (see `option-backslash` about including spaces and backslashes). +--- include a space or comma in a file name, precede it with backslashes +--- (see `option-backslash` about including spaces/commas and backslashes). --- When a file name starts with "./", the '.' is replaced with the path --- of the current file. But only when the 'd' flag is not included in --- 'cpoptions'. Environment variables are expanded `:set_env`. Also see |