Mercurial > vim
comparison src/tag.c @ 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 | 5512aa74cb62 |
children | 435726a03481 |
comparison
equal
deleted
inserted
replaced
19616:2b785ea6d1f4 | 19617:5ce724c60c4c |
---|---|
3227 tagp->command_end = p - 1; // drop trailing bar | 3227 tagp->command_end = p - 1; // drop trailing bar |
3228 else | 3228 else |
3229 tagp->command_end = p; | 3229 tagp->command_end = p; |
3230 p += 2; // skip ";\"" | 3230 p += 2; // skip ";\"" |
3231 if (*p++ == TAB) | 3231 if (*p++ == TAB) |
3232 while (ASCII_ISALPHA(*p)) | 3232 // Accept ASCII alphabetic kind characters and any multi-byte |
3233 // character. | |
3234 while (ASCII_ISALPHA(*p) || mb_ptr2len(p) > 1) | |
3233 { | 3235 { |
3234 if (STRNCMP(p, "kind:", 5) == 0) | 3236 if (STRNCMP(p, "kind:", 5) == 0) |
3235 tagp->tagkind = p + 5; | 3237 tagp->tagkind = p + 5; |
3236 else if (STRNCMP(p, "user_data:", 10) == 0) | 3238 else if (STRNCMP(p, "user_data:", 10) == 0) |
3237 tagp->user_data = p + 10; | 3239 tagp->user_data = p + 10; |
3243 pt = vim_strchr(p, '\t'); | 3245 pt = vim_strchr(p, '\t'); |
3244 if (pc == NULL || (pt != NULL && pc > pt)) | 3246 if (pc == NULL || (pt != NULL && pc > pt)) |
3245 tagp->tagkind = p; | 3247 tagp->tagkind = p; |
3246 if (pt == NULL) | 3248 if (pt == NULL) |
3247 break; | 3249 break; |
3248 p = pt + 1; | 3250 p = pt; |
3251 MB_PTR_ADV(p); | |
3249 } | 3252 } |
3250 } | 3253 } |
3251 if (tagp->tagkind != NULL) | 3254 if (tagp->tagkind != NULL) |
3252 { | 3255 { |
3253 for (p = tagp->tagkind; | 3256 for (p = tagp->tagkind; |
3254 *p && *p != '\t' && *p != '\r' && *p != '\n'; ++p) | 3257 *p && *p != '\t' && *p != '\r' && *p != '\n'; MB_PTR_ADV(p)) |
3255 ; | 3258 ; |
3256 tagp->tagkind_end = p; | 3259 tagp->tagkind_end = p; |
3257 } | 3260 } |
3258 if (tagp->user_data != NULL) | 3261 if (tagp->user_data != NULL) |
3259 { | 3262 { |
3260 for (p = tagp->user_data; | 3263 for (p = tagp->user_data; |
3261 *p && *p != '\t' && *p != '\r' && *p != '\n'; ++p) | 3264 *p && *p != '\t' && *p != '\r' && *p != '\n'; MB_PTR_ADV(p)) |
3262 ; | 3265 ; |
3263 tagp->user_data_end = p; | 3266 tagp->user_data_end = p; |
3264 } | 3267 } |
3265 } | 3268 } |
3266 return retval; | 3269 return retval; |
4004 vim_free(full_fname); | 4007 vim_free(full_fname); |
4005 | 4008 |
4006 if (tp.command_end != NULL) | 4009 if (tp.command_end != NULL) |
4007 { | 4010 { |
4008 for (p = tp.command_end + 3; | 4011 for (p = tp.command_end + 3; |
4009 *p != NUL && *p != '\n' && *p != '\r'; ++p) | 4012 *p != NUL && *p != '\n' && *p != '\r'; MB_PTR_ADV(p)) |
4010 { | 4013 { |
4011 if (p == tp.tagkind || (p + 5 == tp.tagkind | 4014 if (p == tp.tagkind || (p + 5 == tp.tagkind |
4012 && STRNCMP(p, "kind:", 5) == 0)) | 4015 && STRNCMP(p, "kind:", 5) == 0)) |
4013 // skip "kind:<kind>" and "<kind>" | 4016 // skip "kind:<kind>" and "<kind>" |
4014 p = tp.tagkind_end - 1; | 4017 p = tp.tagkind_end - 1; |