]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0583: completion: indent not ignored for fuzzy line completion v9.2.0583
authorglepnir <glephunter@gmail.com>
Mon, 1 Jun 2026 20:15:35 +0000 (20:15 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 1 Jun 2026 20:15:35 +0000 (20:15 +0000)
Problem:  Indent is not stripped in whole-line completion (CTRL-X
          CTRL-L).
Solution: Skip the matched line's indent for whole-line matches in
          search_for_fuzzy_match (glepnir).

closes: #20405

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fuzzy.c
src/testdir/test_ins_complete.vim
src/version.c

index b6d595a7008253c33ac4a22c284229ec9de5c0b3..c8709c1079da5ceee99b8dd85dcaff9f0b4cea5f 100644 (file)
@@ -865,11 +865,15 @@ search_for_fuzzy_match(
                }
                else
                {
-                   if (fuzzy_match_str(*ptr, pattern) != FUZZY_SCORE_NONE)
+                   char_u *line = *ptr;
+                   char_u *p = skipwhite(line);
+                   if (fuzzy_match_str(p, pattern) != FUZZY_SCORE_NONE)
                    {
                        found_new_match = TRUE;
                        *pos = current_pos;
-                       *len = (int)ml_get_buf_len(buf, current_pos.lnum);
+                       *ptr = p;
+                       *len = (int)ml_get_buf_len(buf, current_pos.lnum) -
+                                                               (int)(p - line);
                        break;
                    }
                }
index fbfb45e2f3f3bec2f441d3ce1ea96c0e8290484f..7eda457e1a3b234efe3fffbdf3684025b74b8538 100644 (file)
@@ -3696,10 +3696,16 @@ func Test_complete_opt_fuzzy()
   call feedkeys("Goa\<C-P>\<C-Y>\<Esc>", 'tx')
   call assert_equal('aaaa', getline('.'))
 
+  %d
+  set autoindent
+  set completeopt=menuone,fuzzy
+  call feedkeys("A\<TAB>hello world\<CR>word is on fire\<CR>w\<C-X>\<C-L>\<C-Y>", 'tx')
+  call assert_equal("\thello world", getline('.'))
+
   " clean up
   set omnifunc=
   bw!
-  set complete& completeopt&
+  set complete& completeopt& autoindent&
   autocmd! AAAAA_Group
   augroup! AAAAA_Group
   delfunc OnPumChange
index 02fc6a82f6bb766f64d6f02c15beca05f055d98e..6d7077fe9deeadc7a5e72ff20328b935927af662 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    583,
 /**/
     582,
 /**/