From 92bd07b6062ad54478252b7167a50fc93e60217c Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Fri, 14 Jun 2024 13:59:27 +0000 Subject: support (ignore) universal ctags extended metadata in tagaddress universal ctags "abuses" the tagaddress, which can be an arbitrary vi command even if mg assumes it's just a search pattern, to store metadata after a "vi comment". While it could be worthwile to support the uctags annotations this just ignores them so the search patterns work again. The diff is from Joachim Wiberg "troglobit" mg. ok tb@ --- usr.bin/mg/tags.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/usr.bin/mg/tags.c b/usr.bin/mg/tags.c index ed12493a731..8c9d797334d 100644 --- a/usr.bin/mg/tags.c +++ b/usr.bin/mg/tags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tags.c,v 1.27 2023/03/29 19:09:04 op Exp $ */ +/* $OpenBSD: tags.c,v 1.28 2024/06/14 13:59:26 op Exp $ */ /* * This file is in the public domain. @@ -340,7 +340,7 @@ int addctag(char *s) { struct ctag *t = NULL; - char *l; + char *l, *c; if ((t = malloc(sizeof(struct ctag))) == NULL) { dobeep(); @@ -357,6 +357,15 @@ addctag(char *s) *l++ = '\0'; if (*l == '\0') goto cleanup; + + /* + * Newer universal ctags format abuse vi comments in the + * pattern to store extra metadata. Since we don't support it + * remove it so the pattern is not mangled. + */ + if ((c = strstr(l, ";\"")) != NULL) + *c = '\0'; + t->pat = strip(l, strlen(l)); if (RB_INSERT(tagtree, &tags, t) != NULL) { free(t); -- cgit v1.2.3