aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-06 08:04:42 +0800
committerGitHub <noreply@github.com>2025-02-06 08:04:42 +0800
commit878b3b89c316138d99f9dbc47c84f2f94591df03 (patch)
tree683d13ebf8cf98f9abf1ecffbaf28b293706d71d /test
parent44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff)
downloadrneovim-878b3b89c316138d99f9dbc47c84f2f94591df03.tar.gz
rneovim-878b3b89c316138d99f9dbc47c84f2f94591df03.tar.bz2
rneovim-878b3b89c316138d99f9dbc47c84f2f94591df03.zip
vim-patch:9.1.1077: included syntax items do not understand contains=TOP (#32343)
Problem: Syntax engine interpreted contains=TOP as matching nothing inside included files, since :syn-include forces HL_CONTAINED on for every included item. After 8.2.2761, interprets contains=TOP as contains=@INCLUDED, which is also not correct since it doesn't respect exclusions, and doesn't work if there is no @INCLUDED cluster. Solution: revert patch 8.2.2761, instead track groups that have had HL_CONTAINED forced, and interpret contains=TOP and contains=CONTAINED using this. (Theodore Dubois) fixes: vim/vim#11277 closes: vim/vim#16571 https://github.com/vim/vim/commit/f50d5364d790619a3b982a3ad3658b5a10daf511 Co-authored-by: Theodore Dubois <tblodt@icloud.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_syntax.vim14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/old/testdir/test_syntax.vim b/test/old/testdir/test_syntax.vim
index 207efb6223..6db5d3c04d 100644
--- a/test/old/testdir/test_syntax.vim
+++ b/test/old/testdir/test_syntax.vim
@@ -944,7 +944,7 @@ func Test_syn_contained_transparent()
endfunc
func Test_syn_include_contains_TOP()
- let l:case = "TOP in included syntax means its group list name"
+ let l:case = "TOP in included syntax refers to top level of that included syntax"
new
syntax include @INCLUDED syntax/c.vim
syntax region FencedCodeBlockC start=/```c/ end=/```/ contains=@INCLUDED
@@ -959,6 +959,18 @@ func Test_syn_include_contains_TOP()
bw!
endfunc
+func Test_syn_include_contains_TOP_excluding()
+ new
+ syntax include @INCLUDED syntax/c.vim
+ syntax region FencedCodeBlockC start=/```c/ end=/```/ contains=@INCLUDED
+
+ call setline(1, ['```c', '#if 0', 'int', '#else', 'int', '#if', '#endif', '```' ])
+ let l:expected = ["cCppOutElse", "cConditional"]
+ eval AssertHighlightGroups(6, 1, l:expected, 1)
+ syntax clear
+ bw!
+endfunc
+
" This was using freed memory
func Test_WinEnter_synstack_synID()
autocmd WinEnter * call synstack(line("."), col("."))