comparison src/structs.h @ 33521:1f9b1def80c8 v9.0.2009

patch 9.0.2009: cmdline-completion for comma-separated options wrong Commit: https://github.com/vim/vim/commit/54844857fd6933fa4f6678e47610c4b9c9f7a091 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Mon Oct 9 18:12:31 2023 +0200 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()` 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: #13303 related: #13301 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Mon, 09 Oct 2023 18:30:04 +0200
parents f72004b37b2b
children f99f5a56ff27
comparison
equal deleted inserted replaced
33520:3ea4f0cb88ac 33521:1f9b1def80c8
629 629
630 /* 630 /*
631 * values for xp_backslash 631 * values for xp_backslash
632 */ 632 */
633 #define XP_BS_NONE 0 // nothing special for backslashes 633 #define XP_BS_NONE 0 // nothing special for backslashes
634 #define XP_BS_ONE 1 // uses one backslash before a space 634 #define XP_BS_ONE 0x1 // uses one backslash before a space
635 #define XP_BS_THREE 2 // uses three backslashes before a space 635 #define XP_BS_THREE 0x2 // uses three backslashes before a space
636 #define XP_BS_COMMA 0x4 // commas need to be escaped with a backslash
636 637
637 /* 638 /*
638 * Variables shared between getcmdline(), redrawcmdline() and others. 639 * Variables shared between getcmdline(), redrawcmdline() and others.
639 * These need to be saved when using CTRL-R |, that's why they are in a 640 * These need to be saved when using CTRL-R |, that's why they are in a
640 * structure. 641 * structure.