about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-13 23:27:06 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-13 23:27:06 -0800
commitd79e394a30c99950c74573baab5937ade6529d4a (patch)
treef7fbd679394eefc44f3dcdc1600bc1433a652116
parent3c2a5e26ae48b1b04c44eff776d4b3001d1aa96d (diff)
downloadteliva-d79e394a30c99950c74573baab5937ade6529d4a.tar.gz
reset cursor position when switching definitions
-rw-r--r--src/kilo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/kilo.c b/src/kilo.c
index a8b55d2..edf3617 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -425,6 +425,8 @@ static void editorDelRow(int at) {
 }
 
 void editorClear(void) {
+    E.cx = E.cy = 0;
+    E.rowoff = E.coloff = 0;
     for (int j = E.numrows-1; j >= 0; j--)
       editorDelRow(j);
 }