From 9354baee3c9eba033d4d443e01469baea53295ae Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 13 Apr 2011 15:48:35 +0200 Subject: [PATCH] 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. --- winboard/wgamelist.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) 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); } -- 1.7.0.4