diff src/tag.c @ 15808:37d31fc37a5a v8.1.0911

patch 8.1.0911: tag line with Ex command cannot have extra fields commit https://github.com/vim/vim/commit/943e9639a9ecb08bdec78ae6695c917bca6210b9 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 13 21:19:14 2019 +0100 patch 8.1.0911: tag line with Ex command cannot have extra fields Problem: Tag line with Ex command cannot have extra fields. Solution: Recognize |;" as the end of the command. (closes https://github.com/vim/vim/issues/2402)
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Feb 2019 21:30:06 +0100
parents 6f1c7e9a6393
children 734b1928a5aa
line wrap: on
line diff
--- a/src/tag.c
+++ b/src/tag.c
@@ -3014,7 +3014,10 @@ parse_match(
 	p = tagp->command;
 	if (find_extra(&p) == OK)
 	{
-	    tagp->command_end = p;
+	    if (p > tagp->command && p[-1] == '|')
+		tagp->command_end = p - 1;  // drop trailing bar
+	    else
+		tagp->command_end = p;
 	    p += 2;	/* skip ";\"" */
 	    if (*p++ == TAB)
 		while (ASCII_ISALPHA(*p))
@@ -3784,7 +3787,7 @@ find_extra(char_u **pp)
 {
     char_u	*str = *pp;
 
-    /* Repeat for addresses separated with ';' */
+    // Repeat for addresses separated with ';'
     for (;;)
     {
 	if (VIM_ISDIGIT(*str))
@@ -3798,7 +3801,16 @@ find_extra(char_u **pp)
 		++str;
 	}
 	else
-	    str = NULL;
+	{
+	    // not a line number or search string, look for terminator.
+	    str = (char_u *)strstr((char *)str, "|;\"");
+	    if (str != NULL)
+	    {
+		++str;
+		break;
+	    }
+
+	}
 	if (str == NULL || *str != ';'
 		  || !(VIM_ISDIGIT(str[1]) || str[1] == '/' || str[1] == '?'))
 	    break;