patch 9.2.0583: completion: indent not ignored for fuzzy line completion

Commit: 
https://github.com/vim/vim/commit/9fa5f64135c1b018ca5bfc86d851ac8185f6472b
Author: glepnir <[email protected]>
Date:   Mon Jun 1 20:15:35 2026 +0000

    patch 9.2.0583: completion: indent not ignored for fuzzy line completion
    
    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/fuzzy.c b/src/fuzzy.c
index b6d595a70..c8709c107 100644
--- a/src/fuzzy.c
+++ b/src/fuzzy.c
@@ -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;
                    }
                }
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index fbfb45e2f..7eda457e1 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -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("  hello world", getline('.'))
+
   " clean up
   set omnifunc=
   bw!
-  set complete& completeopt&
+  set complete& completeopt& autoindent&
   autocmd! AAAAA_Group
   augroup! AAAAA_Group
   delfunc OnPumChange
diff --git a/src/version.c b/src/version.c
index 02fc6a82f..6d7077fe9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    583,
 /**/
     582,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1wU9Gu-000aLI-Aa%40256bit.org.

Raspunde prin e-mail lui