From 0edc2e86378fdfe00255be3ac30c56eff359c961 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 28 May 2019 20:55:06 +0200 Subject: Mark selected day in the appointments panel in multiple days mode Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/custom.c | 2 +- src/ui-day.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/custom.c b/src/custom.c index d474d5b..01e6ba3 100644 --- a/src/custom.c +++ b/src/custom.c @@ -52,7 +52,7 @@ static struct attribute attr; * Define window attributes (for both color and non-color terminals): * ATTR_HIGHEST are for window titles * ATTR_HIGH are for month and days names - * ATTR_MIDDLE are for the selected day inside calendar panel + * ATTR_MIDDLE are for the selected day inside calendar and appointments panel * ATTR_LOW are for days inside calendar panel which contains an event * ATTR_LOWEST are for current day inside calendar panel */ diff --git a/src/ui-day.c b/src/ui-day.c index 82db4e5..7774764 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -1112,7 +1112,7 @@ void ui_day_draw(int n, WINDOW *win, int y, int hilt, void *cb_data) struct day_item *item = day_get_item(n); /* The item order always indicates the date. */ time_t date = update_time_in_date(item->order, 0, 0); - int width = lb_apt.sw.w - 2; + int width = lb_apt.sw.w - 2, is_slctd; hilt = hilt && (wins_slctd() == APP); if (item->type == EVNT || item->type == RECUR_EVNT) { @@ -1121,18 +1121,19 @@ void ui_day_draw(int n, WINDOW *win, int y, int hilt, void *cb_data) day_display_item_date(item, win, !hilt, date, y, 1); day_display_item(item, win, !hilt, width - 1, y + 1, 1); } else if (item->type == DAY_HEADING) { + is_slctd = conf.multiple_days && (date == get_slctd_day()); if (conf.header_line && n) { wmove(win, y, 0); whline(win, ACS_HLINE, width); } char *buf = fmt_day_heading(date); utf8_chop(buf, width); - custom_apply_attr(win, ATTR_HIGHEST); + custom_apply_attr(win, is_slctd ? ATTR_MIDDLE : ATTR_HIGHEST); mvwprintw(win, y + (conf.header_line && n), conf.heading_pos == RIGHT ? width - utf8_strwidth(buf) - 1 : conf.heading_pos == LEFT ? 1 : (width - utf8_strwidth(buf)) / 2, "%s", buf); - custom_remove_attr(win, ATTR_HIGHEST); + custom_remove_attr(win, is_slctd ? ATTR_MIDDLE : ATTR_HIGHEST); mem_free(buf); } } -- cgit v1.2.3-54-g00ecf