From 9f4310c24ca39284ad768a82d368e749b18fd76c Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Sun, 28 Dec 2025 02:45:38 -0500 Subject: put more emphasis on TxtLoc --- txt.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'txt.h') diff --git a/txt.h b/txt.h index 21712af..54b2146 100644 --- a/txt.h +++ b/txt.h @@ -28,16 +28,26 @@ typedef struct { u32 len; } Txt; -TxtLoc txt_at(Txt *b, u32 cur); - u32 txt_split_piece(Txt *b, u32 pi, u32 i); void txt_remove_piece(Txt *b, u32 pi); void txt_insert_piece(Txt *b, u32 pi, TxtBufIdx buf, u32 ofs, u32 n); -void txt_buf_append(Txt *b, TxtBufIdx bi, const char *s, u32 n); u32 txt_insert(Txt *b, u32 cur, const char *s, u32 n); -u32 txt_insert_c(Txt *b, u32 cur, char ch); u32 txt_delete(Txt *b, u32 cur, u32 n); -int txt_open(Txt *b, const char *path); +u32 txt_insert_c(Txt *b, u32 cur, u32 ch); +u32 txt_delete_c(Txt *b, u32 cur); +int txt_load(Txt *b, const char *path); +int txt_save(Txt *b, const char *path); +void txt_free(Txt *b); + +TxtLoc txt_at(Txt *b, u32 cur); +u32 txt_ofs(Txt *b, TxtLoc l); +TxtLoc txt_next(Txt *b, TxtLoc l); +TxtLoc txt_prev(Txt *b, TxtLoc l); +int txt_at_start(Txt *b, TxtLoc l); +int txt_at_end(Txt *b, TxtLoc l); + +u32 txt_chr(Txt *b, TxtLoc l); +u8 txt_byte(Txt *b, TxtLoc l); #endif -- cgit v1.2.3