feat: Previous and next line on line limits.
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user