Patch 8.2.4917
Problem: Fuzzy expansion of option names is not right.
Solution: Pass the fuzzy flag down the call chain. (Christian Brabandt,
closes #10380, closes #10318)
Files: src/cmdexpand.c, src/option.c, src/proto/option.pro,
src/testdir/test_options.vim
*** ../vim-8.2.4916/src/cmdexpand.c 2022-05-07 12:48:24.074194794 +0100
--- src/cmdexpand.c 2022-05-08 21:07:43.262062820 +0100
***************
*** 2787,2793 ****
if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
! ret = ExpandSettings(xp, ®match, pat, numMatches, matches);
else if (xp->xp_context == EXPAND_MAPPINGS)
ret = ExpandMappings(pat, ®match, numMatches, matches);
# if defined(FEAT_EVAL)
--- 2787,2793 ----
if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS)
! ret = ExpandSettings(xp, ®match, pat, numMatches, matches, fuzzy);
else if (xp->xp_context == EXPAND_MAPPINGS)
ret = ExpandMappings(pat, ®match, numMatches, matches);
# if defined(FEAT_EVAL)
*** ../vim-8.2.4916/src/option.c 2022-05-07 20:01:10.062731687 +0100
--- src/option.c 2022-05-08 21:07:43.262062820 +0100
***************
*** 6511,6517 ****
regmatch_T *regmatch,
char_u *fuzzystr,
int *numMatches,
! char_u ***matches)
{
int num_normal = 0; // Nr of matching non-term-code
settings
int num_term = 0; // Nr of matching terminal code
settings
--- 6511,6518 ----
regmatch_T *regmatch,
char_u *fuzzystr,
int *numMatches,
! char_u ***matches,
! int can_fuzzy)
{
int num_normal = 0; // Nr of matching non-term-code
settings
int num_term = 0; // Nr of matching terminal code
settings
***************
*** 6527,6533 ****
int fuzzy;
fuzmatch_str_T *fuzmatch = NULL;
! fuzzy = cmdline_fuzzy_complete(fuzzystr);
// do this loop twice:
// loop == 0: count the number of matching options
--- 6528,6534 ----
int fuzzy;
fuzmatch_str_T *fuzmatch = NULL;
! fuzzy = can_fuzzy && cmdline_fuzzy_complete(fuzzystr);
// do this loop twice:
// loop == 0: count the number of matching options
*** ../vim-8.2.4916/src/proto/option.pro 2022-04-15 13:53:30.040708711
+0100
--- src/proto/option.pro 2022-05-08 21:07:43.262062820 +0100
***************
*** 64,70 ****
void set_iminsert_global(void);
void set_imsearch_global(void);
void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
! int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int
*numMatches, char_u ***matches);
int ExpandOldSetting(int *num_file, char_u ***file);
int shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);
--- 64,70 ----
void set_iminsert_global(void);
void set_imsearch_global(void);
void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
! int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int
*numMatches, char_u ***matches, int do_fuzzy);
int ExpandOldSetting(int *num_file, char_u ***file);
int shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);
*** ../vim-8.2.4916/src/testdir/test_options.vim 2022-04-15
13:17:54.386867455 +0100
--- src/testdir/test_options.vim 2022-05-08 21:07:43.262062820 +0100
***************
*** 1257,1260 ****
--- 1257,1282 ----
set cdhome&
endfunc
+ func Test_set_completion_2()
+ CheckOption termguicolors
+
+ " Test default option completion
+ set wildoptions=
+ call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"set termguicolors', @:)
+
+ call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"set notermguicolors', @:)
+
+ " Test fuzzy option completion
+ set wildoptions=fuzzy
+ call feedkeys(":set termg\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"set termguicolors termencoding', @:)
+
+ call feedkeys(":set notermg\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"set notermguicolors', @:)
+
+ set wildoptions=
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4916/src/version.c 2022-05-08 20:38:03.068550496 +0100
--- src/version.c 2022-05-08 21:09:53.573949587 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4917,
/**/
--
hundred-and-one symptoms of being an internet addict:
139. You down your lunch in five minutes, at your desk, so you can
spend the rest of the hour surfing the Net.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220508201143.61F851C0645%40moolenaar.net.