diff options
| author | WormHeamer | 2026-01-01 17:45:03 -0500 |
|---|---|---|
| committer | WormHeamer | 2026-01-01 17:45:03 -0500 |
| commit | 29130a2b0a52e3375593fd14c5dcc0b549baaa8a (patch) | |
| tree | 23305b74f44f9efaf3fb5f292f4db311431b99e6 | |
| parent | 4144c47d9e927cb822816158812327185056bbbe (diff) | |
hopefully fix invalid TxtLoc after some searches
| -rw-r--r-- | main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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) { |
