diff --git a/src/main.c b/src/main.c index faa1de5..1b8f2b7 100644 --- a/src/main.c +++ b/src/main.c @@ -71,6 +71,7 @@ int main_game_loop(int argc, char *argv[]) { /* Initialize ncurses */ stdscr = initscr(); curs_set(0); /* Hide cursor */ + keypad(stdscr, TRUE); /* Enable special key detection */ clear(); /* Initialize colors */ @@ -168,6 +169,9 @@ int main_game_loop(int argc, char *argv[]) { if (key == 27) { /* ESC */ break; + } else if (key == KEY_UP || key == KEY_DOWN || key == KEY_LEFT || key == KEY_RIGHT) { + /* Ignore arrow keys to prevent crashes */ + continue; } else if (key == '\n' || key == '\r' || key == KEY_ENTER) { if (game.current_guess_length == WORD_LENGTH) { strcpy(temp_guess, game.current_guess);