diff options
| author | WormHeamer | 2025-12-28 19:46:16 -0500 |
|---|---|---|
| committer | WormHeamer | 2025-12-28 19:46:16 -0500 |
| commit | 3ed6bbd8eb7214268d6e042736dcd5285cb4f4d7 (patch) | |
| tree | f2659d8eb9f9e5f7e50d1a78de8a88e28464199f /txt.c | |
| parent | a24ee30efa43bcfc06b0e8b956bd077f8515c6e5 (diff) | |
add Txt pointer to TxtLoc
Diffstat (limited to 'txt.c')
| -rw-r--r-- | txt.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -215,11 +215,11 @@ u32 txt_chr(Txt *t, TxtLoc l) { TxtLoc txt_at(Txt *b, u32 cur) { for (u32 i = 0; i < b->ptbl.n; i++) { if (cur < b->ptbl.v[i].n) { - return (TxtLoc) { i, cur }; + return (TxtLoc) { b, i, cur }; } cur -= b->ptbl.v[i].n; } - return (TxtLoc) { b->ptbl.n - 1, b->ptbl.v[b->ptbl.n - 1].n }; + return (TxtLoc) { b, b->ptbl.n - 1, b->ptbl.v[b->ptbl.n - 1].n }; } u32 txt_ofs(Txt *b, TxtLoc l) { @@ -244,11 +244,11 @@ TxtLoc txt_next(Txt *b, TxtLoc l) { TxtLoc txt_prev(Txt *b, TxtLoc l) { if (l.i > 0) { - return (TxtLoc) { l.p, l.i - 1 }; + return (TxtLoc) { b, l.p, l.i - 1 }; } else if (l.p > 0) { - return (TxtLoc) { l.p - 1, b->ptbl.v[l.p - 1].n - 1 }; + return (TxtLoc) { b, l.p - 1, b->ptbl.v[l.p - 1].n - 1 }; } else { - return (TxtLoc) { 0, 0 }; + return (TxtLoc) { b, 0, 0 }; } } |
