diff options
| author | WormHeamer | 2025-12-31 05:43:46 -0500 |
|---|---|---|
| committer | WormHeamer | 2025-12-31 05:43:46 -0500 |
| commit | 83df7c5a4bed79c53357fd91c393071de1eb60a2 (patch) | |
| tree | bdbeffd79f60743cae260c4c78d509474d54ce1e /txt.c | |
| parent | d723f8a5d54f098f0cf378e5dcf3a7d4ec049822 (diff) | |
add (hacky and slow) reverse regex search
Diffstat (limited to 'txt.c')
| -rw-r--r-- | txt.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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)) { |
