From 22038539bfb622a0c53ff779c083f68dc3e87f30 Mon Sep 17 00:00:00 2001 From: Timo Hirvonen Date: Sat, 24 May 2008 18:30:31 +0300 Subject: [PATCH] Add --show-cursor command line option Displaying cursor is required for screen readers. --- Doc/cmus.txt | 3 +++ ui_curses.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Doc/cmus.txt b/Doc/cmus.txt index 6f0e321..3915e78 100644 --- a/Doc/cmus.txt +++ b/Doc/cmus.txt @@ -32,6 +32,9 @@ it can be controlled from the outside via *cmus-remote*(1). --plugins List available plugins and exit. +--show-cursor + Keep cursor always visible. This is useful for screen readers. + --help Display usage information and exit. diff --git a/ui_curses.c b/ui_curses.c index 2b5882e..613a84c 100644 --- a/ui_curses.c +++ b/ui_curses.c @@ -117,6 +117,7 @@ static int track_win_x = 0; static int track_win_y = 0; static int track_win_w = 0; +static int show_cursor; static int cursor_x; static int cursor_y; @@ -1244,7 +1245,13 @@ static void post_update(void) move(LINES - 1, 0); } refresh(); - curs_set(0); + + /* visible cursor is useful for screen readers */ + if (show_cursor) { + curs_set(1); + } else { + curs_set(0); + } } } @@ -2106,6 +2113,7 @@ static void exit_all(void) enum { FLAG_LISTEN, FLAG_PLUGINS, + FLAG_SHOW_CURSOR, FLAG_HELP, FLAG_VERSION, NR_FLAGS @@ -2114,6 +2122,7 @@ enum { static struct option options[NR_FLAGS + 1] = { { 0, "listen", 1 }, { 0, "plugins", 0 }, + { 0, "show-cursor", 0 }, { 0, "help", 0 }, { 0, "version", 0 }, { 0, NULL, 0 } @@ -2127,6 +2136,7 @@ static const char *usage = " ADDR is either a UNIX socket or host[:port]\n" " WARNING: using TCP/IP is insecure!\n" " --plugins list available plugins and exit\n" +" --show-cursor always visible cursor\n" " --help display this help and exit\n" " --version " VERSION "\n" "\n" @@ -2160,6 +2170,9 @@ int main(int argc, char *argv[]) case FLAG_LISTEN: server_address = xstrdup(arg); break; + case FLAG_SHOW_CURSOR: + show_cursor = 1; + break; } } -- 2.11.4.GIT