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 <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
glepnir
2026-06-01 20:15:35 +00:00
committed by Christian Brabandt
parent e2d1c334ee
commit 9fa5f64135
3 changed files with 15 additions and 3 deletions
+6 -2
View 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;
}
}
+7 -1
View 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
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
583,
/**/
582,
/**/