patch 9.1.0936: cannot highlight completed text
Problem: cannot highlight completed text
Solution: (optionally) highlight auto-completed text using the
ComplMatchIns highlight group (glepnir)
closes: #16173
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/dumps/Test_pum_matchins_01.dump b/src/testdir/dumps/Test_pum_matchins_01.dump
new file mode 100644
index 0000000..efaa1eb
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_01.dump
@@ -0,0 +1,20 @@
+|f+0#ff404010#ffffff0|o@1> +0#0000000&@71
+|f+0#0000001#e0e0e08|o@1| @11| +0#4040ff13#ffffff0@59
+|b+0#0000001#ffd7ff255|a|r| @11| +0#4040ff13#ffffff0@59
+|你*0#0000001#ffd7ff255|好| +&@10| +0#4040ff13#ffffff0@59
+|~| @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_02.dump b/src/testdir/dumps/Test_pum_matchins_02.dump
new file mode 100644
index 0000000..a3d9be3
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_02.dump
@@ -0,0 +1,20 @@
+|b+0#ff404010#ffffff0|a|r> +0#0000000&@71
+|f+0#0000001#ffd7ff255|o@1| @11| +0#4040ff13#ffffff0@59
+|b+0#0000001#e0e0e08|a|r| @11| +0#4040ff13#ffffff0@59
+|你*0#0000001#ffd7ff255|好| +&@10| +0#4040ff13#ffffff0@59
+|~| @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| |2| |o|f| |3| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_matchins_03.dump b/src/testdir/dumps/Test_pum_matchins_03.dump
new file mode 100644
index 0000000..d1686b7
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_03.dump
@@ -0,0 +1,20 @@
+|你*0#ff404010#ffffff0|好> +0#0000000&@70
+|f+0#0000001#ffd7ff255|o@1| @11| +0#4040ff13#ffffff0@59
+|b+0#0000001#ffd7ff255|a|r| @11| +0#4040ff13#ffffff0@59
+|你*0#0000001#e0e0e08|好| +&@10| +0#4040ff13#ffffff0@59
+|~| @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| |3| |o|f| |3| +0#0000000&@34
diff --git a/src/testdir/dumps/Test_pum_matchins_04.dump b/src/testdir/dumps/Test_pum_matchins_04.dump
new file mode 100644
index 0000000..0a324ef
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_04.dump
@@ -0,0 +1,20 @@
+|f+0&#ffffff0|o@1> @71
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|4| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_pum_matchins_05.dump b/src/testdir/dumps/Test_pum_matchins_05.dump
new file mode 100644
index 0000000..a799fcd
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_matchins_05.dump
@@ -0,0 +1,20 @@
+|f+0&#ffffff0|o@1| > @70
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|5| @10|A|l@1|
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 69228e1..bd36957 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1712,4 +1712,49 @@
call StopVimInTerminal(buf)
endfunc
+func Test_pum_matchins_higlight()
+ CheckScreendump
+ let lines =<< trim END
+ func Omni_test(findstart, base)
+ if a:findstart
+ return col(".")
+ endif
+ return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
+ endfunc
+ set omnifunc=Omni_test
+ hi ComplMatchIns ctermfg=red
+ END
+ call writefile(lines, 'Xscript', 'D')
+ let buf = RunVimInTerminal('-S Xscript', {})
+
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_01', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>\<C-N>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_02', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>\<C-N>\<C-N>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_03', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ " restore after accept
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_04', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ " restore after cancel completion
+ call TermWait(buf)
+ call term_sendkeys(buf, "S\<C-X>\<C-O>\<Space>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_05', {})
+ call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab