patch 9.0.0193: search and match highlgith interfere with virtual text
Problem: Search and match highlgith interfere with virtual text highlight.
(Ben Jackson)
Solution: Check for match highlight after text properties. Reset and
restore search highlight when showing virtual text.
(closes #10892)
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_1.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_1.dump
new file mode 100644
index 0000000..863ded3
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_1.dump
@@ -0,0 +1,6 @@
+>i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| |t|e|x|t| |B+0#ffffff16#e000002|E|F|O|R|E|(+0#0000000#5fd7ff255|h+0&#ffffff0|e|r|e|)| |a|n|d| |t|h|e|r|e| @20
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+| +0#0000000&@41|1|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_2.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_2.dump
new file mode 100644
index 0000000..1d9d11a
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_2.dump
@@ -0,0 +1,6 @@
+|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| >t+0&#ffff4012|e|x|t| |B+0#ffffff16#e000002|E|F|O|R|E|(+0#0000000#5fd7ff255|h+0&#ffff4012|e|r+0&#ffffff0|e|)| |a|n|d| |t|h|e|r|e| @20
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|/+0#0000000&|t|e|x|t| |(|h|e| @32|1|,|1|3| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_3.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_3.dump
new file mode 100644
index 0000000..85ad7dd
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_3.dump
@@ -0,0 +1,6 @@
+|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| >t+0&#ffff4012|e|x|t| |B+0#ffffff16#e000002|E|F|O|R|E|(+0#0000000#ffff4012|h|e|r+0&#ffffff0|e|)| |a|n|d| |t|h|e|r|e| @20
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|:+0#0000000&|c|a|l@1| |m|a|t|c|h|d|e|l|e|t|e|(|t|h|e|m|a|t|c|h|)| @14|1|,|1|3| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_4.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_4.dump
new file mode 100644
index 0000000..a5592ac
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_4.dump
@@ -0,0 +1,6 @@
+|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| >t|e|x|t| |(+0fd7ff255|A+0#ffffff16#e000002|F|T|E|R|h+0#0000000#ffffff0|e|r|e|)| |a|n|d| |t|h|e|r|e| @21
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|:+0#0000000&|c|a|l@1| |D|o|A|f|t|e|r|(|)| @26|1|,|1|3| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_5.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_5.dump
new file mode 100644
index 0000000..0002aa8
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_5.dump
@@ -0,0 +1,6 @@
+|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| >t+0&#ffff4012|e|x|t| |(+0fd7ff255|A+0#ffffff16#e000002|F|T|E|R|h+0#0000000#ffff4012|e|r+0&#ffffff0|e|)| |a|n|d| |t|h|e|r|e| @21
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|s+0#e000002&|e|a|r|c|h| |h|i|t| |B|O|T|.@2|t|i|n|u|i|n|g| |a|t| |T|O|P| +0#0000000&@10|1|,|1|3| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_hi_6.dump b/src/testdir/dumps/Test_prop_inserts_text_hi_6.dump
new file mode 100644
index 0000000..631f51a
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_inserts_text_hi_6.dump
@@ -0,0 +1,6 @@
+|i+0&#ffffff0|n|s|e|r|t| |s|o|m|e| >t+0&#ffff4012|e|x|t| |(|A+0#ffffff16#e000002|F|T|E|R|h+0#0000000#ffff4012|e|r+0&#ffffff0|e|)| |a|n|d| |t|h|e|r|e| @21
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|:+0#0000000&|c|a|l@1| |m|a|t|c|h|d|e|l|e|t|e|(|t|h|e|m|a|t|c|h|)| @14|1|,|1|3| @9|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 701e853..1e5ecc6 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2502,6 +2502,42 @@
call delete('XscriptPropsWithText')
endfunc
+func Test_prop_inserts_text_highlight()
+ CheckRunVimInTerminal
+
+ " Just a basic check for now
+ let lines =<< trim END
+ call setline(1, 'insert some text (here) and there')
+ call prop_type_add('someprop', #{highlight: 'ErrorMsg'})
+ let bef_prop = prop_add(1, 18, #{type: 'someprop', text: 'BEFORE'})
+ set hlsearch
+ let thematch = matchaddpos("DiffAdd", [[1, 18]])
+ func DoAfter()
+ call prop_remove(#{id: g:bef_prop})
+ call prop_add(1, 19, #{type: 'someprop', text: 'AFTER'})
+ let g:thematch = matchaddpos("DiffAdd", [[1, 18]])
+ let @/ = ''
+ endfunc
+ END
+ call writefile(lines, 'XscriptPropsWithHighlight')
+ let buf = RunVimInTerminal('-S XscriptPropsWithHighlight', #{rows: 6, cols: 60})
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_1', {})
+ call term_sendkeys(buf, "/text (he\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_2', {})
+ call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_3', {})
+
+ call term_sendkeys(buf, ":call DoAfter()\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_4', {})
+ call term_sendkeys(buf, "/text (he\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_5', {})
+ call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_6', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptPropsWithHighlight')
+endfunc
+
func Test_props_with_text_after()
CheckRunVimInTerminal