summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-19 23:33:49 -0500
committerJune McEnroe <june@causal.agency>2021-01-19 23:38:11 -0500
commit822f710ade459954384d9f6980c156b73c5ad198 (patch)
treed2c110c58fd73d9d6bc43dcebd9612402daa0e21 /bin
parentEscape \ and / in mtags search patterns (diff)
downloadsrc-822f710ade459954384d9f6980c156b73c5ad198.tar.gz
src-822f710ade459954384d9f6980c156b73c5ad198.zip
Prefer tag matches not preceded by [[:alnum:]]
Otherwise the "id" in "void" matches for "void id".
Diffstat (limited to 'bin')
-rw-r--r--bin/htagml.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/htagml.c b/bin/htagml.c
index 3d555dc8..a3a4101d 100644
--- a/bin/htagml.c
+++ b/bin/htagml.c
@@ -182,6 +182,9 @@ int main(int argc, char *argv[]) {
 
 		size_t mlen = strlen(tag->tag);
 		char *match = (pipe ? hstrstr : strstr)(buf, tag->tag);
+		while (match > buf && isalnum(match[-1])) {
+			match = (pipe ? hstrstr : strstr)(&match[mlen], tag->tag);
+		}
 		if (!match && tag->tag[0] == 'M') {
 			mlen = 4;
 			match = (pipe ? hstrstr : strstr)(buf, "main");
gheader'>2017-09-01Add client readOnly modeJune McEnroe 2017-08-31Clean up merge toolJune McEnroe Choose the version with the most recent access if the modify times are the same. 2017-08-31Choose B for tiles with equal modify timesJune McEnroe This way newer access counts and times will be preserved. 2017-08-31Add quick data file merge toolJune McEnroe Hopefully I won't have to use it ever again. 2017-08-30Use only foreground color for selecting spawnJune McEnroe 2017-08-29Add four additional spawnsJune McEnroe 2017-08-28Add respawningJune McEnroe 2017-08-26Move license above includesJune McEnroe Why was it down there? 2017-08-26Snapshot metadataJune McEnroe 2017-08-26Add meta.c to READMEJune McEnroe 2017-08-26Use MakefileJune McEnroe