diff --git a/src/main.c b/src/main.c index fdc8d38..0a78d36 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,7 @@ int main(void) { // Set needed args args.src = input; + args.show_cursor = true; // Display characters nms_exec(&args); diff --git a/src/nms.c b/src/nms.c index d60e222..7975e2b 100644 --- a/src/nms.c +++ b/src/nms.c @@ -63,6 +63,8 @@ char nms_exec(NmsArgs *args) { cbreak(); noecho(); scrollok(stdscr, true); + if (args->show_cursor == false) + curs_set(0); // Setting up and starting colors if terminal supports them if (has_colors()) { @@ -222,8 +224,10 @@ char nms_exec(NmsArgs *args) { flushinp(); // Position cursor - if (args->input_cursor_y >= 0 && args->input_cursor_x >= 0) + if (args->input_cursor_y >= 0 && args->input_cursor_x >= 0) { move(args->input_cursor_y, args->input_cursor_x); + curs_set(1); + } // If stdin is set to the keyboard, user must press a key to continue if (isatty(STDIN_FILENO)) { diff --git a/src/nms.h b/src/nms.h index d3bede3..061a6b3 100644 --- a/src/nms.h +++ b/src/nms.h @@ -1,13 +1,16 @@ #ifndef NMS_H #define NMS_H 1 -#define INIT_NMSARGS { .src = NULL, .return_opts = NULL, .input_cursor_x = -1, .input_cursor_y = -1 } +#include + +#define INIT_NMSARGS { NULL, NULL, -1, -1, false } typedef struct { char *src; char *return_opts; int input_cursor_x; int input_cursor_y; + bool show_cursor; } NmsArgs; // Function prototypes