summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/ui.c b/ui.c
index 82c4716..22b098e 100644
--- a/ui.c
+++ b/ui.c
@@ -1133,7 +1133,6 @@ static FILE *saveFile;
 int uiSave(void) {
 	int error = 0
 		|| ftruncate(fileno(saveFile), 0)
-		|| fseek(saveFile, 0, SEEK_SET)
 		|| writeTime(saveFile, Signatures[7])
 		|| writeTime(saveFile, self.pos);
 	if (error) return error;
@@ -1180,13 +1179,9 @@ static ssize_t readString(FILE *file, char **buf, size_t *cap) {
 }
 
 void uiLoad(const char *name) {
-	saveFile = dataOpen(name, "r+");
-	if (!saveFile) {
-		if (errno != ENOENT) exit(EX_NOINPUT);
-		saveFile = dataOpen(name, "w");
-		if (!saveFile) exit(EX_CANTCREAT);
-		return;
-	}
+	saveFile = dataOpen(name, "a+");
+	if (!saveFile) exit(EX_CANTCREAT);
+	rewind(saveFile);
 
 	time_t signature;
 	fread(&signature, sizeof(signature), 1, saveFile);
479d6dd67b6c5&follow=1'>Avoid matching ':' in make tagsJune McEnroe Otherwise a :: rule includes one of the ':'s in the tag name. 2021-01-19Prefer tag matches not preceded by [[:alnum:]]June McEnroe Otherwise the "id" in "void" matches for "void id". 2021-01-19Escape \ and / in mtags search patternsJune McEnroe 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe These don't really go together, but... 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe Otherwise it ends up going into Shell state. 2021-01-18Allow matching lexers using first input lineJune McEnroe