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

3 views
Skip to first unread message

Christian Brabandt

unread,
Jun 1, 2026, 4:30:13 PM (9 days ago) Jun 1
to vim...@googlegroups.com
patch 9.2.0583: completion: indent not ignored for fuzzy line completion

Commit: https://github.com/vim/vim/commit/9fa5f64135c1b018ca5bfc86d851ac8185f6472b
Author: glepnir <gleph...@gmail.com>
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 <gleph...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

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,
/**/
Reply all
Reply to author
Forward
0 new messages