summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@cvs.openbsd.org>2024-06-14 13:59:27 +0000
committerOmar Polo <op@cvs.openbsd.org>2024-06-14 13:59:27 +0000
commit92bd07b6062ad54478252b7167a50fc93e60217c (patch)
tree1b935c4194e4753880c0913124056c0b685f5363
parented56464445eb9656f264be17af245996b762469b (diff)
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@
-rw-r--r--usr.bin/mg/tags.c13
1 files 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);