summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWormHeamer2026-01-01 17:45:03 -0500
committerWormHeamer2026-01-01 17:45:03 -0500
commit29130a2b0a52e3375593fd14c5dcc0b549baaa8a (patch)
tree23305b74f44f9efaf3fb5f292f4db311431b99e6
parent4144c47d9e927cb822816158812327185056bbbe (diff)
hopefully fix invalid TxtLoc after some searches
-rw-r--r--main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main.c b/main.c
index 479235a..d511084 100644
--- a/main.c
+++ b/main.c
@@ -648,7 +648,8 @@ search_from_start:
if (at_end(t)) re_search_last_chunk(&s);
ReMatch m;
if (re_search_match(&s, &m)) {
- *out = (TxtLoc) { p.t, p.p, p.i + m.extent.start };
+ while (m.extent.start--) p = bnext(p);
+ *out = p;
return 1;
}
}
@@ -682,8 +683,8 @@ search_from_end:
Str chnk = txt_next_chunk(&t);
re_search_chunk(&s, chnk.s, chnk.n);
if (at_end(t)) re_search_last_chunk(&s);
- if (re_search_match_at_start(&s, &m) && m.extent.start == 0) {
- *out = (TxtLoc) { p.t, p.p, p.i + m.extent.start };
+ if (re_search_match_at_start(&s, &m)) {
+ *out = p;
return 1;
}
if (~s.flags & RE_SEARCH_MID_MATCH) {