about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kilo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kilo.c b/src/kilo.c
index b0d04a0..2635778 100644
--- a/src/kilo.c
+++ b/src/kilo.c
@@ -1070,10 +1070,10 @@ static void editorProcessKeypress(lua_State* L) {
     switch(c) {
     case ENTER:
         {
-            erow* oldrow = &E.row[E.rowoff + E.cy];
             editorInsertNewline();
             /* auto-indent */
-            for (int x = 0; x < oldrow->size && oldrow->chars[x] == ' '; ++x)
+            erow* prevrow = &E.row[E.rowoff + E.cy - 1];
+            for (int x = 0; x < prevrow->size && prevrow->chars[x] == ' '; ++x)
                 editorInsertChar(' ');
         }
         break;