diff options
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)) { |
