tictactoe

Tic Tac Toe on the terminal using ANSI Escape Codes
Index Commits Files Refs README LICENSE
commit 6335eb9577a442b87a723d4d13b459c58bec2582
parent d9baf8652b8793f9924e69e311948ffa3fd3104b
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Fri, 23 Aug 2024 12:28:29 -0300

set cursor shape to block at exit

it's not possible to restore the previous cursor shape because there
is no way to query the cursor shape at the start, so it defaults
to block shape

Diffstat:
Mtictactoe.cpp | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tictactoe.cpp b/tictactoe.cpp
@@ -150,6 +150,7 @@ void game_redraw_board(void) {
 void game_tui_cleanup(void) {
     tui_reset_input_mode();
     std::cout << "\033[" << TUI_TOTAL_HEIGHT-(cursor_row*2)-1 << "E";
+    std::cout << "\033[0 q"; // block cursor shape
 }
 
 void game_tui_setup(void) {
@@ -158,7 +159,7 @@ void game_tui_setup(void) {
     signal(SIGQUIT, game_sig_handler);
     signal(SIGTSTP, SIG_IGN);
     atexit(game_tui_cleanup);
-    std::cout << "\033[4 q"; // blinking block cursor
+    std::cout << "\033[4 q"; // underline cursor shape
 }
 
 void game_initialize_board(void) {