feat: Previous and next line on line limits.

This commit is contained in:
jmug
2026-11-08 11:21:05 -08:00
parent 779b0808e0
commit 10e3427740
+6
View File
@@ -349,11 +349,17 @@ void editorMoveCursor(int key) {
case ARROW_LEFT: case ARROW_LEFT:
if (E.cx != 0) { if (E.cx != 0) {
E.cx--; 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; break;
case ARROW_RIGHT: case ARROW_RIGHT:
if (row && E.cx < row->size) { if (row && E.cx < row->size) {
E.cx++; E.cx++;
} else if (row && E.cx == row->size) { // Go to next line on right at end.
E.cy++;
E.cx = 0;
} }
break; break;
case ARROW_UP: case ARROW_UP: