]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1776: completion: "adding" expansion doesn't work with cfc=keyword v9.1.1776
authorzeertzjq <zeertzjq@outlook.com>
Sat, 20 Sep 2025 14:12:14 +0000 (14:12 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 20 Sep 2025 14:12:14 +0000 (14:12 +0000)
Problem:  "adding" expansion doesn't work with cfc=keyword.
Solution: Remove incorrect assignment to compl_cont_status. Don't use
          fuzzy collection in "adding" status (zeertzjq).

related: neovim/neovim#35842
closes: #18351

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index d4375f17cec7a2049eef8243662fb6fc97f4efdf..0beea079d4245a12540e30060ad3bbde678643e5 100644 (file)
@@ -5005,8 +5005,9 @@ get_next_default_completion(ins_compl_next_state_T *st, pos_T *start_pos)
     int                looped_around = FALSE;
     char_u     *ptr = NULL;
     int                len = 0;
-    int                in_fuzzy_collect = (cfc_has_mode() && compl_length > 0)
-       || ((get_cot_flags() & COT_FUZZY) && compl_autocomplete);
+    int                in_fuzzy_collect = !compl_status_adding()
+               && ((cfc_has_mode() && compl_length > 0)
+                   || ((get_cot_flags() & COT_FUZZY) && compl_autocomplete));
     char_u     *leader = ins_compl_leader();
     int                score = FUZZY_SCORE_NONE;
     int                in_curbuf = st->ins_buf == curbuf;
@@ -7114,11 +7115,6 @@ ins_compl_start(void)
            compl_col = curwin->w_cursor.col;
            compl_lnum = curwin->w_cursor.lnum;
        }
-       else if (ctrl_x_mode_normal() && cfc_has_mode())
-       {
-           compl_startpos = curwin->w_cursor;
-           compl_cont_status &= CONT_S_IPOS;
-       }
     }
     else
     {
index 703a1eeecfef7cf41cab21efee521efd482f892e..b48f0deec62801d09b3af4673470f91aa6306191 100644 (file)
@@ -3607,6 +3607,14 @@ func Test_complete_fuzzy_collect()
   call feedkeys("A\<C-X>\<C-N>\<C-N>\<Esc>0", 'tx!')
   call assert_equal('你的 我的 我的', getline('.'))
 
+  " check that "adding" expansion works
+  call setline(1, ['hello world foo bar'])
+  call feedkeys("Ohlo\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<Esc>0", 'tx!')
+  call assert_equal('hello world foo bar', getline('.'))
+  call feedkeys("Swld\<C-X>\<C-N>\<C-X>\<C-N>\<C-X>\<C-N>\<Esc>0", 'tx!')
+  call assert_equal('world foo bar', getline('.'))
+  %delete
+
   " fuzzy on file
   call writefile([''], 'fobar', 'D')
   call writefile([''], 'foobar', 'D')
index c79b2b23bd8e06e36fe3a2fbb2058ed35f93dc50..be217095ac68748af72f17114d6c2f22f4ad4928 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1776,
 /**/
     1775,
 /**/