comparison 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
comparison
equal deleted inserted replaced
15807:55ffa98b7166 15808:37d31fc37a5a
3012 { 3012 {
3013 /* Try to find a kind field: "kind:<kind>" or just "<kind>"*/ 3013 /* Try to find a kind field: "kind:<kind>" or just "<kind>"*/
3014 p = tagp->command; 3014 p = tagp->command;
3015 if (find_extra(&p) == OK) 3015 if (find_extra(&p) == OK)
3016 { 3016 {
3017 tagp->command_end = p; 3017 if (p > tagp->command && p[-1] == '|')
3018 tagp->command_end = p - 1; // drop trailing bar
3019 else
3020 tagp->command_end = p;
3018 p += 2; /* skip ";\"" */ 3021 p += 2; /* skip ";\"" */
3019 if (*p++ == TAB) 3022 if (*p++ == TAB)
3020 while (ASCII_ISALPHA(*p)) 3023 while (ASCII_ISALPHA(*p))
3021 { 3024 {
3022 if (STRNCMP(p, "kind:", 5) == 0) 3025 if (STRNCMP(p, "kind:", 5) == 0)
3782 static int 3785 static int
3783 find_extra(char_u **pp) 3786 find_extra(char_u **pp)
3784 { 3787 {
3785 char_u *str = *pp; 3788 char_u *str = *pp;
3786 3789
3787 /* Repeat for addresses separated with ';' */ 3790 // Repeat for addresses separated with ';'
3788 for (;;) 3791 for (;;)
3789 { 3792 {
3790 if (VIM_ISDIGIT(*str)) 3793 if (VIM_ISDIGIT(*str))
3791 str = skipdigits(str); 3794 str = skipdigits(str);
3792 else if (*str == '/' || *str == '?') 3795 else if (*str == '/' || *str == '?')
3796 str = NULL; 3799 str = NULL;
3797 else 3800 else
3798 ++str; 3801 ++str;
3799 } 3802 }
3800 else 3803 else
3801 str = NULL; 3804 {
3805 // not a line number or search string, look for terminator.
3806 str = (char_u *)strstr((char *)str, "|;\"");
3807 if (str != NULL)
3808 {
3809 ++str;
3810 break;
3811 }
3812
3813 }
3802 if (str == NULL || *str != ';' 3814 if (str == NULL || *str != ';'
3803 || !(VIM_ISDIGIT(str[1]) || str[1] == '/' || str[1] == '?')) 3815 || !(VIM_ISDIGIT(str[1]) || str[1] == '/' || str[1] == '?'))
3804 break; 3816 break;
3805 ++str; /* skip ';' */ 3817 ++str; /* skip ';' */
3806 } 3818 }