aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_help.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-07-12 18:03:09 +0000
committerKalle Wallin <kaw@linux.se>2004-07-12 18:03:09 +0000
commitac6690f65f65ef8bd823fa6a9fa37ec05afd6acb (patch)
tree5f49331c1622be3a37a134af24d12ca4c60474df /src/screen_help.c
parentd5ca1e00d91bbc0ad4543a6456c9a3209ca2e269 (diff)
downloadmpd-ac6690f65f65ef8bd823fa6a9fa37ec05afd6acb.tar.gz
mpd-ac6690f65f65ef8bd823fa6a9fa37ec05afd6acb.tar.xz
mpd-ac6690f65f65ef8bd823fa6a9fa37ec05afd6acb.zip
Hide the cursor on the help screen (#247)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1854 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/screen_help.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/src/screen_help.c b/src/screen_help.c
index 4d76ffe7f..4d1db1594 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -188,6 +188,7 @@ static void
help_init(WINDOW *w, int cols, int rows)
{
lw = list_window_init(w, cols, rows);
+ lw->flags = LW_HIDE_CURSOR;
}
static void
@@ -233,15 +234,56 @@ help_update(screen_t *screen, mpdclient_t *c)
static int
help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
{
- int retval;
+ lw->repaint=1;
+ switch(cmd)
+ {
+ case CMD_LIST_NEXT:
+ if( lw->start+lw->rows < help_text_rows )
+ lw->start++;
+ return 1;
+ case CMD_LIST_PREVIOUS:
+ if( lw->start >0 )
+ lw->start--;
+ return 1;
+ case CMD_LIST_FIRST:
+ lw->start = 0;
+ return 1;
+ case CMD_LIST_LAST:
+ lw->start = help_text_rows-lw->rows;
+ if( lw->start<0 )
+ lw->start = 0;
+ return 1;
+ case CMD_LIST_NEXT_PAGE:
+ lw->start = lw->start + lw->rows;
+ if( lw->start+lw->rows >= help_text_rows )
+ lw->start = help_text_rows-lw->rows;
+ if( lw->start<0 )
+ lw->start = 0;
+ return 1;
+ case CMD_LIST_PREVIOUS_PAGE:
+ lw->start = lw->start - lw->rows;
+ if( lw->start<0 )
+ lw->start = 0;
+ return 1;
+ default:
+ break;
+ }
- retval = list_window_cmd(lw, help_text_rows, cmd);
- if( !retval )
- return screen_find(screen, c,
- lw, help_text_rows,
- cmd, list_callback);
+ lw->selected = lw->start+lw->rows;
+ if( screen_find(screen, c,
+ lw, help_text_rows,
+ cmd, list_callback) )
+ {
+ /* center the row */
+ lw->start = lw->selected-(lw->rows/2);
+ if( lw->start+lw->rows > help_text_rows )
+ lw->start = help_text_rows-lw->rows;
+ if( lw->start<0 )
+ lw->start=0;
+ return 1;
+ }
- return retval;
+ return 0;
}
static list_window_t *