summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-29 01:03:46 -0500
committerC. McEnroe2020-02-29 01:03:46 -0500
commit8570a62235e5e9b6a6d719fd8b92cedc91a1d511 (patch)
tree209a365efebcec4457f4563a4308e6c5c8cdfdf4 /ui.c
parent78b4832bfe10b90e522bbb51c05ee19a361bf318 (diff)
Implement the causal.agency/consumer capability
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui.c b/ui.c
index d6f79c2..b3f3b09 100644
--- a/ui.c
+++ b/ui.c
@@ -960,7 +960,8 @@ void uiRead(void) {
 
 static const time_t Signatures[] = {
 	0x6C72696774616301, // no heat, unread, unreadWarm
-	0x6C72696774616302,
+	0x6C72696774616302, // no self.pos
+	0x6C72696774616303,
 };
 
 static size_t signatureVersion(time_t signature) {
@@ -981,7 +982,8 @@ int uiSave(const char *name) {
 	FILE *file = dataOpen(name, "w");
 	if (!file) return -1;
 
-	if (writeTime(file, Signatures[1])) return -1;
+	if (writeTime(file, Signatures[2])) return -1;
+	if (writeTime(file, self.pos)) return -1;
 	for (uint num = 0; num < windows.len; ++num) {
 		const struct Window *window = windows.ptrs[num];
 		if (writeString(file, idNames[window->id])) return -1;
@@ -1032,6 +1034,10 @@ void uiLoad(const char *name) {
 	}
 	size_t version = signatureVersion(signature);
 
+	if (version > 1) {
+		self.pos = readTime(file);
+	}
+
 	char *buf = NULL;
 	size_t cap = 0;
 	while (0 < readString(file, &buf, &cap)) {