patch 9.0.0186: virtual text without highlighting does not show
Problem: Virtual text without highlighting does not show. (Ben Jackson)
Solution: Use a text property when it has highlighting or when it has text.
(closes #10878)
diff --git a/src/drawline.c b/src/drawline.c
index 2b47648..d38cf73 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1706,7 +1706,8 @@
proptype_T *pt = text_prop_type_by_id(
wp->w_buffer, text_props[tpi].tp_type);
- if (pt != NULL && pt->pt_hl_id > 0
+ if (pt != NULL && (pt->pt_hl_id > 0
+ || text_props[tpi].tp_id < 0)
&& text_props[tpi].tp_id != -MAXCOL)
{
used_attr = syn_id2attr(pt->pt_hl_id);
diff --git a/src/testdir/dumps/Test_prop_inserts_text_1.dump b/src/testdir/dumps/Test_prop_inserts_text_1.dump
index 2cd71f6..7d1b102 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_1.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_1.dump
@@ -3,6 +3,6 @@
|p|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @40
|F|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @34
|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@49
+|l|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @42
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_2.dump b/src/testdir/dumps/Test_prop_inserts_text_2.dump
index 095e232..2a5b2f3 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_2.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_2.dump
@@ -3,6 +3,6 @@
| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
| +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @40
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|1|,|7|6|-|9|2| @6|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_3.dump b/src/testdir/dumps/Test_prop_inserts_text_3.dump
index b438142..36a4b8c 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_3.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_3.dump
@@ -3,6 +3,6 @@
| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s>t| @38
| +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @40
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|2|,|7|-|1|9| @7|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_4.dump b/src/testdir/dumps/Test_prop_inserts_text_4.dump
index 8c3a022..8bb637a 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_4.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_4.dump
@@ -3,6 +3,6 @@
| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
| +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=>1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @40
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|3|,|1|3|-|1|6| @6|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_5.dump b/src/testdir/dumps/Test_prop_inserts_text_5.dump
index c7e1c57..75194f6 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_5.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_5.dump
@@ -3,6 +3,6 @@
| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
| +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=>2+0#0000000&| |}|;| @32
| +0#0000e05#a8a8a8255@1|e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @40
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|3|,|1|6|-|2@1| @6|A|l@1|
diff --git a/src/testdir/dumps/Test_prop_inserts_text_6.dump b/src/testdir/dumps/Test_prop_inserts_text_6.dump
index acef485..fb25ddf 100644
--- a/src/testdir/dumps/Test_prop_inserts_text_6.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_6.dump
@@ -3,6 +3,6 @@
| +0#0000e05#a8a8a8255@1|p+0#0000000#ffffff0|r|e|s+0&#e0e0e08|ö|m|e|和*&|平|t+&|é|x|t|p+0&#ffffff0|o|s|t| @38
| +0#0000e05#a8a8a8255@1|F+0#0000000#ffffff0|o@1| |f|o@1| |=| |{| |.+0#0000e05&|x|=|1+0#0000000&|,| |.+0#0000e05&|y|=|2+0#0000000&| |}|;| @32
| +0#0000e05#a8a8a8255@1>e+0#ffffff16#e000002|m|p|t|y| |l|i|n|e| +0#0000000#ffffff0@47
+| +0#0000e05#a8a8a8255@1|l+0#0000000#ffffff0|o@1|k| |n|o| |h|i|g|h|l|i|g|h|t| @40
|~+0#4040ff13&| @58
-|~| @58
| +0#0000000&@41|4|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 29cd599..c6d15b5 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2469,12 +2469,16 @@
call prop_add(2, 4, #{type: 'multibyte', text: 'söme和平téxt'})
call setline(3, 'Foo foo = { 1, 2 };')
- call prop_type_add( 'testprop', #{highlight: 'Comment'})
+ call prop_type_add('testprop', #{highlight: 'Comment'})
call prop_add(3, 13, #{type: 'testprop', text: '.x='})
call prop_add(3, 16, #{type: 'testprop', text: '.y='})
call setline(4, '')
call prop_add(4, 1, #{type: 'someprop', text: 'empty line'})
+
+ call setline(5, 'look highlight')
+ call prop_type_add('nohi', #{})
+ call prop_add(5, 6, #{type: 'nohi', text: 'no '})
END
call writefile(lines, 'XscriptPropsWithText')
let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 8, cols: 60})
diff --git a/src/version.c b/src/version.c
index eb9566c..6e278e5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 186,
+/**/
185,
/**/
184,