diff options
-rw-r--r-- | c/episodelistview.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c index 1ce49b1..925ce23 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -135,7 +135,7 @@ ElvSetTop(int iItem) void ElvSelectRecent() { - int iEpisode, iItem; + int i, iEpisode, iItem; LVFINDINFO lvfi; term_t t; @@ -144,14 +144,15 @@ ElvSelectRecent() P("track_episodes","most_recently_watched",1,t) goto s; GI(t,&iEpisode) return; + i = 0; lvfi.flags = LVFI_PARAM; lvfi.lParam = iEpisode; - - iItem = ListView_FindItem(HElv, -1, &lvfi); + do + lvfi.lParam = iEpisode+i; + while ((iItem = ListView_FindItem(HElv, -1, &lvfi)) == -1 && i++ < 100); if (iItem == -1) return; -s: - ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED); +s: ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED); ElvSetTop(iItem > 5? iItem-5: 0); ListView_SetItemState(HElv, iItem, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); |