From 3f504146399685aabd70cbb4fda93ddb3270c861 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 9 May 2010 09:01:26 +0000 Subject: [PATCH] Change cursor key up and down behaviour in watching-menu. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@566 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index 6c7ecf6..a6ffc8e 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -671,6 +671,7 @@ inprogressmenu (int gameid) drawbanner (&banner, 1, 1); if (len > 0) { + if (offset < 0) offset = 0; mvaddstr (3, 1, "The following games are in progress:"); for (di = 0; di < ARRAY_SIZE(watchcols); di++) { @@ -762,16 +763,18 @@ inprogressmenu (int gameid) switch ((menuchoice = dgl_getch ())) { case KEY_DOWN: - if (selected != -1) { - selected++; - if (selected >= len) selected = 0; - } + selected++; + if (selected >= len) selected = 0; + while (selected < offset) offset -= max_height; + while (selected >= offset+max_height) offset += max_height; break; case KEY_UP: if (selected != -1) { if (selected == 0) selected = len; selected--; - } + } else selected = len-1; + while (selected < offset) offset -= max_height; + while (selected >= offset+max_height) offset += max_height; break; case '*': if (len > 0) {