From 92c925816e3a150b69d80d42d3d15198602d460f Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 8 Aug 2011 11:00:12 +0200 Subject: [PATCH] Fix up/down arrows in game list --- xgamelist.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xgamelist.c b/xgamelist.c index abccb04..5767b98 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -363,6 +363,7 @@ GameListPrepare(int byPos) } static char *list[1003]; +int listEnd; static void GameListReplace(int page) @@ -374,7 +375,8 @@ GameListReplace(int page) int i; if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = ""; - for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) break; + for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) { st--; break; } + listEnd = st - list; if(page + 1000 <= listLength) *st++ = _("next page"); *st = NULL; @@ -576,8 +578,8 @@ LoadSelectedProc(w, event, prms, nprms) if(doLoad) direction /= 3; index += direction; if(direction == -2) index = 0; - if(direction == 2) index = listLength-1; - if(index < 0 || index >= listLength) return; + if(direction == 2) index = listEnd-1; + if(index < 0 || index >= listEnd) return; XawListHighlight(listwidg, index); if(!doLoad) return; } -- 1.7.0.4