Skip to content

Commit e890887

Browse files
glepnirchrisbra
authored andcommitted
patch 9.1.0996: ComplMatchIns may highlight wrong text
Problem: ComplMatchIns may highlight wrong text Solution: don't highlight in case of fuzzy match, skip-highlight when not inserting anything (glepnir) closes: #16404 Signed-off-by: glepnir <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 1718e7d commit e890887

File tree

6 files changed

+62
-2
lines changed

6 files changed

+62
-2
lines changed

src/highlight.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ static char *(highlight_init_both[]) = {
262262
"default link PmenuMatchSel PmenuSel",
263263
"default link PmenuExtra Pmenu",
264264
"default link PmenuExtraSel PmenuSel",
265-
CENT("ComplMatchIns cterm=NONE", "ComplMatchIns gui=NONE"),
265+
CENT("ComplMatchIns ctermfg=DarkGrey cterm=NONE",
266+
"ComplMatchIns guifg=DarkGrey gui=NONE"),
266267
CENT("Normal cterm=NONE", "Normal gui=NONE"),
267268
NULL
268269
};

src/insexpand.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,10 @@ ins_compl_insert_bytes(char_u *p, int len)
924924
int
925925
ins_compl_col_range_attr(int col)
926926
{
927-
if (col >= compl_col && col < compl_ins_end_col)
927+
if ((get_cot_flags() & COT_FUZZY))
928+
return -1;
929+
930+
if (col >= (compl_col + (int)compl_leader.length) && col < compl_ins_end_col)
928931
return syn_name2attr((char_u *)"ComplMatchIns");
929932

930933
return -1;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
|f+8&#40ff4011@1|o+8#ffff4012#ff404010@1> +8#0000000#40ff4011@70
2+
| +0#0000001#e0e0e08|f|o@1| @11| +0#4040ff13#4040ff13@58
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|~| @73
11+
|~| @73
12+
|~| @73
13+
|~| @73
14+
|~| @73
15+
|~| @73
16+
|~| @73
17+
|~| @73
18+
|~| @73
19+
|~| @73
20+
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
|f+8&#40ff4011@1|o@1> @70
2+
| +0#0000001#e0e0e08|f|o@1| @11| +0#4040ff13#4040ff13@58
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|~| @73
11+
|~| @73
12+
|~| @73
13+
|~| @73
14+
|~| @73
15+
|~| @73
16+
|~| @73
17+
|~| @73
18+
|~| @73
19+
|~| @73
20+
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34

src/testdir/test_popup.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,20 @@ func Test_pum_matchins_highlight_combine()
18161816
call VerifyScreenDump(buf, 'Test_pum_matchins_combine_06', {})
18171817
call term_sendkeys(buf, "\<Esc>")
18181818

1819+
" Does not highlight the compl leader
1820+
call TermWait(buf)
1821+
call term_sendkeys(buf, ":set cot+=menuone,noselect\<CR>")
1822+
call TermWait(buf)
1823+
call term_sendkeys(buf, "S\<C-X>\<C-O>f\<C-N>")
1824+
call VerifyScreenDump(buf, 'Test_pum_matchins_combine_07', {})
1825+
call term_sendkeys(buf, "\<C-E>\<Esc>")
1826+
1827+
call term_sendkeys(buf, ":set cot+=fuzzy\<CR>")
1828+
call TermWait(buf)
1829+
call term_sendkeys(buf, "S\<C-X>\<C-O>f\<C-N>")
1830+
call VerifyScreenDump(buf, 'Test_pum_matchins_combine_08', {})
1831+
call term_sendkeys(buf, "\<C-E>\<Esc>")
1832+
18191833
call StopVimInTerminal(buf)
18201834
endfunc
18211835

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
996,
707709
/**/
708710
995,
709711
/**/

0 commit comments

Comments
 (0)