summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--txt.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/txt.c b/txt.c
index 61b0c22..b3074aa 100644
--- a/txt.c
+++ b/txt.c
@@ -200,19 +200,14 @@ void txt_free(Txt *t) {
u8 txt_byte(Txt *t, TxtLoc l) {
TxtPiece *p = &t->ptbl.v[l.p];
TxtBuf *b = &t->buf[p->buf];
- //if (l.p < t->ptbl.n && l.i == p->n) p++, l.i = 0;
- if (p->ofs + l.i >= b->n) return 0;
+ if (l.i >= p->n) return 0;
return b->s[p->ofs + l.i];
}
u32 txt_chr(Txt *t, TxtLoc l) {
TxtPiece *p = &t->ptbl.v[l.p];
TxtBuf *b = &t->buf[p->buf];
- /*
- * is this ever executed?
- * if (l.p < t->ptbl.n && l.i == p->n) p++, l.i = 0;
- */
- return utf8_decode_at(b->s, p->ofs + l.i, b->n);
+ return utf8_decode_at(b->s, p->ofs + l.i, p->ofs + p->n);
}
/* cursor manipulation */