From: op Date: Fri, 14 Jun 2024 13:59:26 +0000 (+0000) Subject: support (ignore) universal ctags extended metadata in tagaddress X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b7ad015ce7826251d163a2df2cc75cab23ec3d06;p=openbsd 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@ --- 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);