Patch 8.2.2761
Problem: Using "syn include" does not work properly.
Solution: Don't add current_syn_inc_tag to topgrp. (Jaehwang Jerry Jung,
closes #8104)
Files: src/syntax.c, src/testdir/test_syntax.vim
*** ../vim-8.2.2760/src/syntax.c 2021-01-03 19:51:01.392063235 +0100
--- src/syntax.c 2021-04-14 11:10:00.977539305 +0200
***************
*** 5990,6001 ****
break;
}
if (name[1] == 'A')
! id = SYNID_ALLBUT;
else if (name[1] == 'T')
! id = SYNID_TOP;
else
! id = SYNID_CONTAINED;
! id += current_syn_inc_tag;
}
else if (name[1] == '@')
{
--- 5990,6006 ----
break;
}
if (name[1] == 'A')
! id = SYNID_ALLBUT + current_syn_inc_tag;
else if (name[1] == 'T')
! {
! if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER)
! id = curwin->w_s->b_syn_topgrp;
! else
! id = SYNID_TOP + current_syn_inc_tag;
! }
else
! id = SYNID_CONTAINED + current_syn_inc_tag;
!
}
else if (name[1] == '@')
{
*** ../vim-8.2.2760/src/testdir/test_syntax.vim 2020-11-29 14:11:33.163022803 +0100
--- src/testdir/test_syntax.vim 2021-04-14 11:12:22.605192611 +0200
***************
*** 920,923 ****
--- 920,940 ----
bw!
endfunc
+ func Test_syn_include_contains_TOP()
+ let l:case = "TOP in included syntax means its group list name"
+ new
+ syntax include @INCLUDED syntax/c.vim
+ syntax region FencedCodeBlockC start=/```c/ end=/```/ contains=@INCLUDED
+
+ call setline(1, ['```c', '#if 0', 'int', '#else', 'int', '#endif', '```' ])
+ let l:expected = ["cCppOutIf2"]
+ eval AssertHighlightGroups(3, 1, l:expected, 1)
+ " cCppOutElse has contains=TOP
+ let l:expected = ["cType"]
+ eval AssertHighlightGroups(5, 1, l:expected, 1, l:case)
+ syntax clear
+ bw!
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2760/src/version.c 2021-04-13 21:47:59.544306690 +0200
--- src/version.c 2021-04-14 11:14:02.452943508 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2761,
/**/
--
From "know your smileys":
|-( Contact lenses, but has lost them
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///