From f7f59bffc4d4e1ba41a47d2258ee902ededffb5b Mon Sep 17 00:00:00 2001 From: Keyoonz <89485044+Keyoonz@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:17:48 +0200 Subject: [PATCH] fix moving cursor --- .gitignore | 1 + src/input.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ab89d79..5d7c2b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp/* bin/* +doc/* diff --git a/src/input.c b/src/input.c index a97d1e6..fb56a04 100644 --- a/src/input.c +++ b/src/input.c @@ -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;