From: glepnir Date: Mon, 1 Jun 2026 20:15:35 +0000 (+0000) Subject: patch 9.2.0583: completion: indent not ignored for fuzzy line completion X-Git-Tag: v9.2.0583^0 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=9fa5f64135c1b018ca5bfc86d851ac8185f6472b;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/fuzzy.c b/src/fuzzy.c index b6d595a700..c8709c1079 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 fbfb45e2f3..7eda457e1a 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\\\", 'tx') call assert_equal('aaaa', getline('.')) + %d + set autoindent + set completeopt=menuone,fuzzy + call feedkeys("A\hello world\word is on fire\w\\\", '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 diff --git a/src/version.c b/src/version.c index 02fc6a82f6..6d7077fe9d 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, /**/