changeset 19617:5ce724c60c4c v8.2.0365

patch 8.2.0365: tag kind can't be a multi-byte character Commit: https://github.com/vim/vim/commit/283e5f4e69b204e0eafd408548e69b7ca9b4871b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 9 08:17:52 2020 +0100 patch 8.2.0365: tag kind can't be a multi-byte character Problem: Tag kind can't be a multi-byte character. (Marcin Szamotulski) Solution: Recognize multi-byte character. (closes https://github.com/vim/vim/issues/5724)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Mar 2020 08:30:04 +0100
parents 2b785ea6d1f4
children 4b2a45315826
files src/tag.c src/testdir/test_taglist.vim src/version.c
diffstat 3 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/tag.c
+++ b/src/tag.c
@@ -3229,7 +3229,9 @@ parse_match(
 		tagp->command_end = p;
 	    p += 2;	// skip ";\""
 	    if (*p++ == TAB)
-		while (ASCII_ISALPHA(*p))
+		// Accept ASCII alphabetic kind characters and any multi-byte
+		// character.
+		while (ASCII_ISALPHA(*p) || mb_ptr2len(p) > 1)
 		{
 		    if (STRNCMP(p, "kind:", 5) == 0)
 			tagp->tagkind = p + 5;
@@ -3245,20 +3247,21 @@ parse_match(
 			tagp->tagkind = p;
 		    if (pt == NULL)
 			break;
-		    p = pt + 1;
+		    p = pt;
+		    MB_PTR_ADV(p);
 		}
 	}
 	if (tagp->tagkind != NULL)
 	{
 	    for (p = tagp->tagkind;
-			    *p && *p != '\t' && *p != '\r' && *p != '\n'; ++p)
+			    *p && *p != '\t' && *p != '\r' && *p != '\n'; MB_PTR_ADV(p))
 		;
 	    tagp->tagkind_end = p;
 	}
 	if (tagp->user_data != NULL)
 	{
 	    for (p = tagp->user_data;
-			    *p && *p != '\t' && *p != '\r' && *p != '\n'; ++p)
+			    *p && *p != '\t' && *p != '\r' && *p != '\n'; MB_PTR_ADV(p))
 		;
 	    tagp->user_data_end = p;
 	}
@@ -4006,7 +4009,7 @@ get_tags(list_T *list, char_u *pat, char
 	    if (tp.command_end != NULL)
 	    {
 		for (p = tp.command_end + 3;
-				   *p != NUL && *p != '\n' && *p != '\r'; ++p)
+			  *p != NUL && *p != '\n' && *p != '\r'; MB_PTR_ADV(p))
 		{
 		    if (p == tp.tagkind || (p + 5 == tp.tagkind
 					      && STRNCMP(p, "kind:", 5) == 0))
--- a/src/testdir/test_taglist.vim
+++ b/src/testdir/test_taglist.vim
@@ -7,6 +7,7 @@ func Test_taglist()
 	\ "BFoo\tXbar\t1",
 	\ "BBar\tXbar\t2",
 	\ "Kindly\tXbar\t3;\"\tv\tfile:",
+	\ "Lambda\tXbar\t3;\"\tλ\tfile:",
 	\ "Command\tXbar\tcall cursor(3, 4)|;\"\td",
 	\ ], 'Xtags')
   set tags=Xtags
@@ -17,12 +18,16 @@ func Test_taglist()
   call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name}))
   call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name}))
 
-  let kind = taglist("Kindly")
-  call assert_equal(1, len(kind))
-  call assert_equal('v', kind[0]['kind'])
-  call assert_equal('3', kind[0]['cmd'])
-  call assert_equal(1, kind[0]['static'])
-  call assert_equal('Xbar', kind[0]['filename'])
+  let kindly = taglist("Kindly")
+  call assert_equal(1, len(kindly))
+  call assert_equal('v', kindly[0]['kind'])
+  call assert_equal('3', kindly[0]['cmd'])
+  call assert_equal(1, kindly[0]['static'])
+  call assert_equal('Xbar', kindly[0]['filename'])
+
+  let lambda = taglist("Lambda")
+  call assert_equal(1, len(lambda))
+  call assert_equal('λ', lambda[0]['kind'])
 
   let cmd = taglist("Command")
   call assert_equal(1, len(cmd))
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    365,
+/**/
     364,
 /**/
     363,