changeset 26620:c4055c13fbe9 v8.2.3839

patch 8.2.3839: using z() with z1 not tested for syntax highlighting Commit: https://github.com/vim/vim/commit/354b23a9f87fd8c5aec457d88320a0a5bce4b985 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Fri Dec 17 17:32:29 2021 +0000 patch 8.2.3839: using \z() with \z1 not tested for syntax highlighting Problem: Using \z() with \z1 not tested for syntax highlighting. Solution: Add a test. (Dominique Pell?, closes https://github.com/vim/vim/issues/9365)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Dec 2021 18:45:04 +0100
parents ff9d60f09d34
children 714142b47ff8
files src/testdir/test_syntax.vim src/version.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_syntax.vim
+++ b/src/testdir/test_syntax.vim
@@ -662,6 +662,24 @@ func Test_syntax_c()
   call delete('Xtest.c')
 endfun
 
+" Test \z(...) along with \z1
+func Test_syn_zsub()
+  new
+  syntax on
+  call setline(1,  'xxx start foo xxx not end foo xxx end foo xxx')
+  let l:expected = '    ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ    '
+
+  for l:re in [0, 1, 2]
+    " Example taken from :help :syn-ext-match
+    syntax region Z start="start \z(\I\i*\)" skip="not end \z1" end="end \z1"
+    eval AssertHighlightGroups(1, 1, l:expected, 1, 'regexp=' .. l:re)
+    syntax clear Z
+  endfor
+
+  set re&
+  bw!
+endfunc
+
 " Using \z() in a region with NFA failing should not crash.
 func Test_syn_wrong_z_one()
   new
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3839,
+/**/
     3838,
 /**/
     3837,