diff options
Diffstat (limited to 'src/kilo.c')
-rw-r--r-- | src/kilo.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/kilo.c b/src/kilo.c index 4b5e3dc..5b9fd76 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1063,7 +1063,13 @@ static void editorProcessKeypress(lua_State* L) { int c = getch(); switch(c) { case ENTER: - editorInsertNewline(); + { + erow* oldrow = &E.row[E.rowoff + E.cy]; + editorInsertNewline(); + /* auto-indent */ + for (int x = 0; x < oldrow->size && oldrow->chars[x] == ' '; ++x) + editorInsertChar(' '); + } break; case CTRL_C: if (Previous_error != NULL) |