fix moving cursor

This commit is contained in:
Keyoonz
2024-09-24 12:17:48 +02:00
parent c613eb6978
commit f7f59bffc4
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -1,2 +1,3 @@
tmp/*
bin/*
doc/*
+4 -4
View File
@@ -2,13 +2,13 @@
void editorMoveCursor(struct editorConfig *E, int key) {
switch (key) {
case CURSOR_LEFT:
case CURSOR_RIGHT:
if (E->cursor_x != 0) {
--E->cursor_x;
}
break;
case CURSOR_DOWN:
if (E->cursor_x != E->screencols - 1) {
if (E->cursor_y != E->screenrows - 1) {
++E->cursor_y;
}
break;
@@ -17,8 +17,8 @@ void editorMoveCursor(struct editorConfig *E, int key) {
--E->cursor_y;
}
break;
case CURSOR_RIGHT:
if (E->cursor_y != E->screenrows - 1) {
case CURSOR_LEFT:
if (E->cursor_x != E->screencols - 1) {
++E->cursor_x;
}
break;