summaryrefslogtreecommitdiff
path: root/txt.c
diff options
context:
space:
mode:
Diffstat (limited to 'txt.c')
-rw-r--r--txt.c9
1 files changed, 9 insertions, 0 deletions
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;
}