about summary refs log tree commit diff stats
path: root/src/lcurses
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-28 11:12:49 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-28 11:38:06 -0800
commit8fd568647ae461de9a5d589c24056ef1f2ce992f (patch)
tree59a62026c22ec8c7d3a116444d5dc40cfc4de1fa /src/lcurses
parent41803e4afc7ed188e9abbdd4d01b1dfe75ffb4ac (diff)
downloadteliva-8fd568647ae461de9a5d589c24056ef1f2ce992f.tar.gz
clear editor state across user-visible restarts
Teliva's constantly restarting without the user being aware of it. So
far I figured saving history across the user actually exiting and
restarting Teliva was just a happy "feature". However, it looks like
that's actually more complex to implement. Keeping editor state across
user-visible restarts results in these problems:

- opening the editor after restart has the cursor position messed up, no
  matter what definition you open.
- more seriously, opening the editor after restart can't seem to get to
  the big-picture view anymore.

Rather than try to debug what's going on, I'm going to just cordon off
that part of the state space for now.
Diffstat (limited to 'src/lcurses')
-rw-r--r--src/lcurses/window.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lcurses/window.c b/src/lcurses/window.c
index 72680d5..8d3d5f1 100644
--- a/src/lcurses/window.c
+++ b/src/lcurses/window.c
@@ -1313,8 +1313,10 @@ Wgetch(lua_State *L)
 
 	if (c == ERR)
 		return 0;
-	if (c == CTRL_X)
+	if (c == CTRL_X) {
+		unlink("teliva_editor_state");
 		exit(0);
+	}
 	if (c == CTRL_E)
 		switch_to_editor(L);
 	/* handle other standard menu hotkeys here */