From 79f562d94a908d3ebfc9ac68a577dbc70f12c450 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Wed, 31 Dec 2025 03:20:25 -0500 Subject: allow opening multiple files at once + replace modes --- txt.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'txt.c') diff --git a/txt.c b/txt.c index 818e4c2..fd51bc4 100644 --- a/txt.c +++ b/txt.c @@ -127,6 +127,7 @@ loop: goto loop; } ASSERT(txt_valid_loc(l)); + l.t->dirty = 1; return resolve_loc(l); } @@ -229,6 +230,13 @@ done: return 0; } +void txt_load_empty(Txt *b) { + memset(b, 0, sizeof(Txt)); + txt_buf_fit(b, TXT_SRC, 32); + txt_buf_fit(b, TXT_ADD, 8192); + txt_insert_piece(b, 0, TXT_ADD, 0, b->len); +} + int txt_save(Txt *t, const char *path) { FILE *f = fopen(path, "wb"); if (!f) return -1; @@ -239,6 +247,7 @@ int txt_save(Txt *t, const char *path) { } int e = ferror(f); fclose(f); + t->dirty = 0; return e ? -1 : 0; } -- cgit v1.2.3