From: H.G. Muller Date: Wed, 13 Apr 2011 13:48:35 +0000 (+0200) Subject: Fix game-list highight error when filtered (WB) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9354baee3c9eba033d4d443e01469baea53295ae;p=xboard.git Fix game-list highight error when filtered (WB) When the gamelist was filtered, the game that was highlingted was the n-th game in the list rather than the n-th game in the file, when the latter was loaded (and n did not exceed the number of filtered games). This is fixed now by searching for the line in the listbox that starts with the game number n, rather than taking the n-th line. --- diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 48aa85d..80ce9b6 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -406,9 +406,15 @@ VOID GameListPopDown(void) VOID GameListHighlight(int index) { + char buf[MSG_SIZ]; + int i, res = 0; if (gameListDialog == NULL) return; + for(i=0; res != LB_ERR; i++) { + res = SendDlgItemMessage( gameListDialog, OPT_GameListText, LB_GETTEXT, i, (LPARAM)buf ); + if(index <= atoi( buf )) break; + } SendDlgItemMessage(gameListDialog, OPT_GameListText, - LB_SETCURSEL, index - 1, 0); + LB_SETCURSEL, i, 0); }