]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0549: fuzzycollect regex based completion not working as expected v9.1.0549
authorglepnir <glephunter@gmail.com>
Tue, 9 Jul 2024 16:51:29 +0000 (18:51 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 9 Jul 2024 16:51:29 +0000 (18:51 +0200)
Problem:  fuzzycollect regex based completion not working as expected
Solution: Revert Patch v9.1.0503 (glepnir)

closes: #15192

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/options.txt
runtime/doc/version9.txt
src/insexpand.c
src/option.h
src/optionstr.c
src/testdir/test_ins_complete.vim
src/version.c

index e9c94aa8e52054a50303510c3287ff16ed1ad6c9..e28f185aa8ce7dab2923395776bfef4bbf2ded82 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.1.  Last change: 2024 Jul 06
+*options.txt*  For Vim version 9.1.  Last change: 2024 Jul 09
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2151,11 +2151,6 @@ A jump table for the options with a short description can be found at |Q_op|.
                    difference how completion candidates are reduced from the
                    list of alternatives, but not how the candidates are
                    collected (using different completion types).
-         fuzzycollect
-                   Enable fuzzy collection for default keyword completion.
-                   This allows the collection of matches using fuzzy matching
-                   criteria, providing more comprehensive and flexible
-                   results. Works in combination with other fuzzy options.
 
                                        *'completepopup'* *'cpp'*
 'completepopup' 'cpp'  string (default empty)
index 86ec0208ac771eed08c1ed54ae40486e0d69ee01..9cf20300fa76bfc0ecbf5cb7ae795259c901812e 100644 (file)
@@ -41646,8 +41646,8 @@ Improved visual highlighting.
 
 Python3 support in OpenVMS.
 
-Support for |fuzzy-matching| during |ins-completion| with the "fuzzy" and
-"fuzzycollect" values of the 'completeopt' setting
+Support for |fuzzy-matching| during |ins-completion| with the "fuzzy"
+values of the 'completeopt' setting
 
 ==============================================================================
 COMPILE TIME CHANGES                                   *compile-changes-9.2*
index 36228e9b13ce1aba952d89ae7e754471233f5bd7..21b53d1e3e85062aaee5e21a2f45be01098a0a6f 100644 (file)
@@ -4512,11 +4512,6 @@ ins_compl_use_match(int c)
     static int
 get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col)
 {
-    int                i;
-    int                char_len;
-    size_t     fuzzy_len;
-    char_u     *fuzzy_pattern;
-
     if ((compl_cont_status & CONT_SOL) || ctrl_x_mode_path_defines())
     {
        if (!compl_status_adding())
@@ -4630,39 +4625,6 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col)
     }
 
     compl_patternlen = STRLEN(compl_pattern);
-
-    if ((get_cot_flags() & COT_FUZZYCOLLECT) != 0)
-    {
-       // Adjust size to avoid buffer overflow
-       fuzzy_len = (size_t)compl_length * 5 + 10;
-       // Allocate enough space
-       fuzzy_pattern = alloc(fuzzy_len);
-       if (fuzzy_pattern == NULL)
-       {
-           compl_patternlen = 0;
-           return FAIL;
-       }
-       // Use 'very magic' mode for simpler syntax
-       STRCPY(fuzzy_pattern, "\\v");
-       i = 2; // Start from 2 to skip "\\v"
-       while (i < compl_length + 2)
-       {
-           // Append "\\k*" before each character
-           STRNCAT(fuzzy_pattern, "\\k*", fuzzy_len - STRLEN(fuzzy_pattern) - 1);
-           // Get length of current multi-byte character
-           char_len = mb_ptr2len(compl_pattern + i);
-           // Concatenate the character safely
-           STRNCAT(fuzzy_pattern, compl_pattern + i, char_len);
-           // Move to the next character
-           i += char_len;
-       }
-       // Append "\\k*" at the end to match any characters after the pattern
-       STRNCAT(fuzzy_pattern, "\\k*", fuzzy_len - STRLEN(fuzzy_pattern) - 1);
-       vim_free(compl_pattern);
-       compl_pattern = fuzzy_pattern;
-       compl_patternlen = STRLEN(compl_pattern);
-    }
-
     return OK;
 }
 
index 67d0b046207712b37b9fc097ad6a3bc0ea798149..630d7bf6b778dd7636c07fd773d867ec82e67d82 100644 (file)
@@ -527,7 +527,6 @@ EXTERN unsigned     cot_flags;      // flags from 'completeopt'
 #define COT_NOINSERT       0x040   // FALSE: select & insert, TRUE: noinsert
 #define COT_NOSELECT       0x080   // FALSE: select & insert, TRUE: noselect
 #define COT_FUZZY          0x100   // TRUE: fuzzy match enabled
-#define COT_FUZZYCOLLECT    0x200   // TRUE: fuzzy collect enabled
 #ifdef BACKSLASH_IN_FILENAME
 EXTERN char_u  *p_csl;         // 'completeslash'
 #endif
index 9adb77dff5f3069ed881386ef176949d98371055..417f7859077a1d6944e5811f9275af6c7b72c447 100644 (file)
@@ -118,7 +118,7 @@ static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
                                NULL};
 static char *(p_fcl_values[]) = {"all", NULL};
 #endif
-static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "popup", "popuphidden", "noinsert", "noselect", "fuzzy", "fuzzycollect", NULL};
+static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "popup", "popuphidden", "noinsert", "noselect", "fuzzy", NULL};
 #ifdef BACKSLASH_IN_FILENAME
 static char *(p_csl_values[]) = {"slash", "backslash", NULL};
 #endif
index 61c8ac764339050c6f1afc6c578f0420d1fe348a..48589ce18887c5e856c4bb5cea332ea8dd67fe40 100644 (file)
@@ -2586,37 +2586,6 @@ func Test_complete_fuzzy_match()
   call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
   call assert_equal('hello help hero h', getline('.'))
 
-  set completeopt=fuzzycollect
-  call setline(1, ['xyz  yxz  x'])
-  call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('xyz  yxz  xyz', getline('.'))
-  " can fuzzy get yxz when use Ctrl-N twice
-  call setline(1, ['xyz  yxz  x'])
-  call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('xyz  yxz  yxz', getline('.'))
-
-  call setline(1, ['one two o'])
-  call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('one two one', getline('.'))
-
-  call setline(1, ['你好 你'])
-  call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('你好 你好', getline('.'))
-  call setline(1, ['你的 我的 的'])
-  call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('你的 我的 你的', getline('.'))
-  " can fuzzy get multiple-byte word when use Ctrl-N twice
-  call setline(1, ['你的 我的 的'])
-  call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
-  call assert_equal('你的 我的 我的', getline('.'))
-
-  "respect noinsert
-  set completeopt=fuzzycollect,menu,menuone,noinsert
-  call setline(1, ['one two o'])
-  call feedkeys("A\<C-X>\<C-N>", 'tx')
-  call assert_equal('one', g:word)
-  call assert_equal('one two o', getline('.'))
-
   " clean up
   set omnifunc=
   bw!
index 1f334caba22ed91de579fa31d02916270978d13a..dd5b254a0743cdc7efa900be6e029871d94a411e 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    549,
 /**/
     548,
 /**/