patch 8.1.2153: combining text property and syntax highlight is wrong
Problem: Combining text property and syntax highlight is wrong. (Nick
Jensen)
Solution: Compute the syntax highlight attribute much earlier.
(closes #5057)
diff --git a/src/testdir/dumps/Test_textprop_syn_1.dump b/src/testdir/dumps/Test_textprop_syn_1.dump
new file mode 100644
index 0000000..6f5aff5
--- /dev/null
+++ b/src/testdir/dumps/Test_textprop_syn_1.dump
@@ -0,0 +1,6 @@
+>(+0(ffff15|a+0#e000e06#ffffff0|b|c|)+0#0000000#40ffff15| +0&#ffffff0@69
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index aede59b..54cf5f3 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -652,9 +652,10 @@
" screenshot test with textprop highlighting
func Test_textprop_screenshot_various()
+ CheckScreendump
" The Vim running in the terminal needs to use utf-8.
- if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8'
- throw 'Skipped: cannot make screendumps or not using utf-8'
+ if g:orig_encoding != 'utf-8'
+ throw 'Skipped: not using utf-8'
endif
call writefile([
\ "call setline(1, ["
@@ -750,9 +751,7 @@
" screenshot test with Visual block mode operations
func Test_textprop_screenshot_visual()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
" Delete two columns while text props are three chars wide.
call RunTestVisualBlock(2, '01')
@@ -762,9 +761,7 @@
endfunc
func Test_textprop_after_tab()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot make screendumps'
- endif
+ CheckScreendump
let lines =<< trim END
call setline(1, [
@@ -785,6 +782,28 @@
call delete('XtestPropTab')
endfunc
+func Test_textprop_with_syntax()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, [
+ \ "(abc)",
+ \ ])
+ syn match csParens "[()]" display
+ hi! link csParens MatchParen
+
+ call prop_type_add('TPTitle', #{ highlight: 'Title' })
+ call prop_add(1, 2, #{type: 'TPTitle', end_col: 5})
+ END
+ call writefile(lines, 'XtestPropSyn')
+ let buf = RunVimInTerminal('-S XtestPropSyn', {'rows': 6})
+ call VerifyScreenDump(buf, 'Test_textprop_syn_1', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPropSyn')
+endfunc
+
" Adding a text property to a new buffer should not fail
func Test_textprop_empty_buffer()
call prop_type_add('comment', {'highlight': 'Search'})