summaryrefslogtreecommitdiff
path: root/txt.c
diff options
context:
space:
mode:
authorWormHeamer2025-12-31 05:43:46 -0500
committerWormHeamer2025-12-31 05:43:46 -0500
commit83df7c5a4bed79c53357fd91c393071de1eb60a2 (patch)
treebdbeffd79f60743cae260c4c78d509474d54ce1e /txt.c
parentd723f8a5d54f098f0cf378e5dcf3a7d4ec049822 (diff)
add (hacky and slow) reverse regex search
Diffstat (limited to 'txt.c')
-rw-r--r--txt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/txt.c b/txt.c
index fd51bc4..a982cd2 100644
--- a/txt.c
+++ b/txt.c
@@ -314,6 +314,17 @@ Str txt_next_chunk(TxtLoc *l) {
return s;
}
+Str txt_prev_chunk(TxtLoc *l) {
+ while (!l->i && l->p > 0) {
+ l->p--;
+ l->i = l->t->ptbl.v[l->p].n;
+ }
+ TxtPiece *p = &l->t->ptbl.v[l->p];
+ Str s = { l->t->buf[p->buf].s + p->ofs, l->i };
+ l->i = 0;
+ return s;
+}
+
int txt_range_equal(TxtLoc lo, TxtLoc hi, Str cmp) {
u32 i = 0;
while (txt_before(lo, hi)) {