aboutsummaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/day.c b/src/day.c
index b556481..5bbc0a4 100644
--- a/src/day.c
+++ b/src/day.c
@@ -106,9 +106,22 @@ int day_sel_index(void)
return -1;
}
+/*
+ * Return the number of days to load in the appointments panel.
+ */
int day_get_days(void)
{
- return conf.multiple_days;
+ int panel, day;
+
+ if (!conf.multiple_days)
+ return 1;
+
+ panel = win[APP].h - (conf.compact_panels ? 2 : 4);
+ /* Assume one event per day (no event separator). */
+ day = 2 + conf.header_line + conf.day_separator + conf.empty_appt_line;
+
+ /* Round up. */
+ return panel / day + (panel % day != 0);
}
static void day_free(struct day_item *day)