From 10e342774000028abeef884c2532abcd1aed6b0d Mon Sep 17 00:00:00 2001 From: jmug Date: Sun, 8 Nov 2026 11:21:05 -0800 Subject: [PATCH] feat: Previous and next line on line limits. --- kilo.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kilo.c b/kilo.c index 3cf390b..60880c5 100644 --- a/kilo.c +++ b/kilo.c @@ -349,11 +349,17 @@ void editorMoveCursor(int key) { case ARROW_LEFT: if (E.cx != 0) { E.cx--; + } else if (E.cy > 0) { // Go to previous line on left at start. + E.cy--; + E.cx = E.row[E.cy].size; } break; case ARROW_RIGHT: if (row && E.cx < row->size) { E.cx++; + } else if (row && E.cx == row->size) { // Go to next line on right at end. + E.cy++; + E.cx = 0; } break; case ARROW_UP: