aboutsummaryrefslogtreecommitdiffstats
path: root/src/recur.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2020-05-23 21:10:26 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2020-05-24 08:52:08 -0400
commit61a743c56acb6854a70094533c6138275d7333b5 (patch)
treeafe1313ec5a5ec6832fbaa2fa4765acff22720b2 /src/recur.c
parentbd238bfd7c443fd974f5b7edd6c1abc0349bfa78 (diff)
downloadcalcurse-61a743c56acb6854a70094533c6138275d7333b5.tar.gz
calcurse-61a743c56acb6854a70094533c6138275d7333b5.zip
Fix "next occurrence" for multi-day appointments
Better name: day for occur. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/recur.c')
-rw-r--r--src/recur.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/recur.c b/src/recur.c
index 647ba11..510fddb 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -1801,18 +1801,21 @@ void recur_apoint_paste_item(struct recur_apoint *rapt, time_t date)
* buffer. Useful for test of a repeated item.
*/
int recur_next_occurrence(time_t s, long d, struct rpt *r, llist_t *e,
- time_t occur, time_t *next)
+ time_t day, time_t *next)
{
int ret = 0;
- if (r->until && r->until <= occur)
+ if (r->until && r->until <= day)
return ret;
- while (!r->until || occur < r->until) {
- occur = NEXTDAY(occur);
- if (!check_sec(&occur))
+ while (!r->until || day < r->until) {
+ day = NEXTDAY(day);
+ if (!check_sec(&day))
break;
- if (recur_item_find_occurrence(s, d, r, e, occur, next)) {
+ if (recur_item_find_occurrence(s, d, r, e, day, next)) {
+ /* Multi-day appointment. */
+ if (*next < day)
+ continue;
ret = 1;
break;
}