From 3b48035f5b9475293ff614c2d5193cf525e55a44 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Thu, 1 Jan 2026 21:37:44 -0500 Subject: make regex line ends more consistent across chunks --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 71c7938..5df9e37 100644 --- a/main.c +++ b/main.c @@ -681,9 +681,10 @@ int search_next_regex(TxtLoc l, Str src, TxtLoc *out) { return 0; } int match_found = 0; -search_from_start: +search_from_start:; TxtLoc t = l; re_search_start(&s, &re, &e.scratch); + if (at_start(t) || txt_chr(cprev(t)) == '\n') re_search_first_chunk(&s); while (!at_end(t)) { Str chnk = txt_next_chunk(&t); re_search_chunk(&s, chnk.s, chnk.n); @@ -720,6 +721,7 @@ search_from_end: Arena a = e.scratch; re_search_start(&s, &re, &e.scratch); TxtLoc t = l; + if (at_start(t) || txt_chr(cprev(t)) == '\n') re_search_first_chunk(&s); while (!at_end(t)) { TxtLoc p = t; Str chnk = txt_next_chunk(&t); -- cgit v1.2.3