patch 9.1.0996: ComplMatchIns may highlight wrong text
Commit:
https://github.com/vim/vim/commit/e890887b8052561ac5f8dce218e578ed28599cc6
Author: glepnir <[email protected]>
Date: Wed Jan 8 18:30:45 2025 +0100
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]>
diff --git a/src/highlight.c b/src/highlight.c
index 628ceb259..f38abd86b 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -262,7 +262,8 @@ static char *(highlight_init_both[]) = {
"default link PmenuMatchSel PmenuSel",
"default link PmenuExtra Pmenu",
"default link PmenuExtraSel PmenuSel",
- CENT("ComplMatchIns cterm=NONE", "ComplMatchIns gui=NONE"),
+ CENT("ComplMatchIns ctermfg=DarkGrey cterm=NONE",
+ "ComplMatchIns guifg=DarkGrey gui=NONE"),
CENT("Normal cterm=NONE", "Normal gui=NONE"),
NULL
};
diff --git a/src/insexpand.c b/src/insexpand.c
index 818b1b96a..22f021de7 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -924,7 +924,10 @@ ins_compl_insert_bytes(char_u *p, int len)
int
ins_compl_col_range_attr(int col)
{
- if (col >= compl_col && col < compl_ins_end_col)
+ if ((get_cot_flags() & COT_FUZZY))
+ return -1;
+
+ if (col >= (compl_col + (int)compl_leader.length) && col <
compl_ins_end_col)
return syn_name2attr((char_u *)"ComplMatchIns");
return -1;
diff --git a/src/testdir/dumps/Test_pum_matchins_combine_07.dump
b/src/testdir/dumps/Test_pum_matchins_combine_07.dump
new file mode 100644
index 000000000..60d5a670f
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_combine_07.dump
@@ -0,0 +1,20 @@
+|f+8(ff4011@1|o+8#ffff4012#ff404010@1> +8#0000000#40ff4011@70
+| +0#0000001#e0e0e08|f|o@1| @11| +0#4040ff13#4040ff13@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+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
diff --git a/src/testdir/dumps/Test_pum_matchins_combine_08.dump
b/src/testdir/dumps/Test_pum_matchins_combine_08.dump
new file mode 100644
index 000000000..c0b414973
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_combine_08.dump
@@ -0,0 +1,20 @@
+|f+8(ff4011@1|o@1> @70
+| +0#0000001#e0e0e08|f|o@1| @11| +0#4040ff13#4040ff13@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+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
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 729fbecff..3f4836fa8 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1816,6 +1816,20 @@ func Test_pum_matchins_highlight_combine()
call VerifyScreenDump(buf, 'Test_pum_matchins_combine_06', {})
call term_sendkeys(buf, "\<Esc>")
+ " Does not highlight the compl leader
+ call TermWait(buf)
+ call term_sendkeys(buf, ":set cot+=menuone,noselect\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>f\<C-N>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_combine_07', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call term_sendkeys(buf, ":set cot+=fuzzy\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>f\<C-N>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_combine_08', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
call StopVimInTerminal(buf)
endfunc
diff --git a/src/version.c b/src/version.c
index 95567b737..38f46927d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 996,
/**/
995,
/**/
--
--
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/E1tVa76-00GFQs-H1%40256bit.org.