aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2018-01-25 00:06:20 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2019-03-13 17:02:26 +0100
commit90f96059c56035cf89de603b911b23e45f80bb6c (patch)
treefda119d16b153d41708b1b319546a1d8b893cdbb /src
parent45fd62cab4bfc2b8ab2cd5b565d5af0406e96349 (diff)
downloadcalcurse-90f96059c56035cf89de603b911b23e45f80bb6c.tar.gz
calcurse-90f96059c56035cf89de603b911b23e45f80bb6c.zip
Fix calendar (re)draw
Window erasure is moved to the drawing functions. Adresses GitHub issue #196. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/ui-calendar.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/ui-calendar.c b/src/ui-calendar.c
index 10ae5cb..20bfd09 100644
--- a/src/ui-calendar.c
+++ b/src/ui-calendar.c
@@ -64,9 +64,6 @@ void ui_calendar_view_next(void)
ui_calendar_view++;
if (ui_calendar_view == CAL_VIEWS)
ui_calendar_view = 0;
-
- /* The calendar panel needs to be erased when switching views. */
- werase(sw_cal.inner);
}
void ui_calendar_view_prev(void)
@@ -74,9 +71,6 @@ void ui_calendar_view_prev(void)
if (ui_calendar_view == 0)
ui_calendar_view = CAL_VIEWS;
ui_calendar_view--;
-
- /* The calendar panel needs to be erased when switching views. */
- werase(sw_cal.inner);
}
void ui_calendar_set_view(int view)
@@ -362,6 +356,8 @@ draw_monthly_view(struct scrollwin *sw, struct date *current_day,
struct tm t;
char *cp;
+ werase(sw->inner);
+
mo = slctd_day.mm;
yr = slctd_day.yyyy;
@@ -389,10 +385,6 @@ draw_monthly_view(struct scrollwin *sw, struct date *current_day,
/* Write the current month and year on top of the calendar */
WINS_CALENDAR_LOCK;
- if (yr * YEARINMONTHS + mo != monthly_view_cache_month) {
- /* erase the window if a new month is selected */
- werase(sw_cal.inner);
- }
custom_apply_attr(sw->inner, ATTR_HIGHEST);
cp = nl_langinfo(MON_1 + mo - 1);
mvwprintw(sw->inner, ofs_y, (w - (strlen(cp) + 5)) / 2,
@@ -475,6 +467,8 @@ draw_weekly_view(struct scrollwin *sw, struct date *current_day,
struct tm t;
int OFFY, OFFX, j;
+ werase(sw->inner);
+
OFFY = 0;
OFFX = (wins_sbar_width() - 2 - WCALWIDTH) / 2;