From 79ccaf8e97f992e6c0e20e9ae6ca33e9a43e8e2b Mon Sep 17 00:00:00 2001 From: Zev Weiss Date: Tue, 21 Jun 2022 02:37:17 -0700 Subject: [PATCH] Hide cursor during initialization and restore at exit Showing the cursor while running (especially on terminals where it blinks) is a bit visually distracting, and doesn't serve much purpose; make it invisible in init_ui() and restore the original state in exit_ui(). --- src/cui.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cui.cpp b/src/cui.cpp index edfaef0..2daa6ab 100644 --- a/src/cui.cpp +++ b/src/cui.cpp @@ -34,6 +34,7 @@ #include std::string *caption; +static int cursOrig; extern const char version[]; extern ProcList *processes; extern timeval curtime; @@ -278,6 +279,7 @@ int GreatestFirst(const void *ma, const void *mb) { void init_ui() { WINDOW *screen = initscr(); + cursOrig = curs_set(0); raw(); noecho(); cbreak(); @@ -291,6 +293,8 @@ void exit_ui() { clear(); endwin(); delete caption; + if (cursOrig != ERR) + curs_set(cursOrig); } void ui_tick() {