aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-04-23 13:32:41 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-04-23 13:32:41 +0200
commit49a31841c05f12a2620ed36faf54d1b525704613 (patch)
treed64be2fc3c6a4acc489be45577fb5d9feecc1d99
parent16902bf221c9fac58218ca50c479f93a3e01943d (diff)
downloadEpisodeBrowser-49a31841c05f12a2620ed36faf54d1b525704613.tar.gz
Fix ElvSelectRecent.
-rw-r--r--c/episodelistview.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 1afee3e..843ef78 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -164,12 +164,20 @@ ElvSelectRecent()
P("track_episodes","most_recently_watched",1,t) goto s;
GI(t,&iEpisode) return;
- i = 0;
lvfi.flags = LVFI_PARAM;
lvfi.lParam = iEpisode;
+ i = 0;
while ((iItem = ListView_FindItem(HElv, -1, &lvfi)) == -1 && i++ < 100)
lvfi.lParam = ++iEpisode;
- if (iItem == -1) return;
+ if (iItem != -1) goto s;
+
+ iEpisode -= 100;
+ lvfi.lParam = iEpisode;
+ i = 0;
+ while ((iItem = ListView_FindItem(HElv, -1, &lvfi)) == -1 && i++ < 100)
+ lvfi.lParam = --iEpisode;
+ if (iItem != -1) goto s;
+ return;
s: ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED);
ElvSetTop(iItem > 5? iItem-5: 0);