From: Richard Russon Date: Fri, 27 Sep 2019 14:52:57 +0000 (+0100) Subject: refactor: clrtobot() to mutt_window_clrtobot() X-Git-Tag: 2019-10-25~30^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1dc502f9fc96e99d7efbdf5afc07fde9fbaf95c3;p=neomutt refactor: clrtobot() to mutt_window_clrtobot() Encapsulate a curses function to reduce dependencies. --- diff --git a/menu.c b/menu.c index d10a78db8..90b2dd72e 100644 --- a/menu.c +++ b/menu.c @@ -363,7 +363,7 @@ void menu_redraw_full(struct Menu *menu) mutt_curses_set_color(MT_COLOR_NORMAL); /* clear() doesn't optimize screen redraws */ move(0, 0); - clrtobot(); + mutt_window_clrtobot(); if (C_Help) { @@ -1086,7 +1086,7 @@ void mutt_menu_pop_current(struct Menu *menu) { CurrentMenu = MENU_MAIN; move(0, 0); - clrtobot(); + mutt_window_clrtobot(); } } diff --git a/mutt_window.c b/mutt_window.c index b1ba9f946..688dda500 100644 --- a/mutt_window.c +++ b/mutt_window.c @@ -98,6 +98,16 @@ void mutt_window_clearline(struct MuttWindow *win, int row) mutt_window_clrtoeol(win); } +/** + * mutt_window_clrtobot - Clear to the bottom of the Window + * + * @note Assumes the cursor has already been positioned within the Window. + */ +void mutt_window_clrtobot(void) +{ + clrtobot(); +} + /** * mutt_window_clrtoeol - Clear to the end of the line * @param win Window diff --git a/mutt_window.h b/mutt_window.h index 15da6d737..1857b15d7 100644 --- a/mutt_window.h +++ b/mutt_window.h @@ -62,6 +62,7 @@ int mutt_window_addch (int ch); int mutt_window_addnstr (const char *str, int num); int mutt_window_addstr (const char *str); void mutt_window_clearline(struct MuttWindow *win, int row); +void mutt_window_clrtobot (void); void mutt_window_clrtoeol (struct MuttWindow *win); int mutt_window_move (struct MuttWindow *win, int row, int col); int mutt_window_mvaddstr (struct MuttWindow *win, int row, int col, const char *str); diff --git a/pager.c b/pager.c index abba13847..5cc1e820e 100644 --- a/pager.c +++ b/pager.c @@ -1944,7 +1944,7 @@ static void pager_custom_redraw(struct Menu *pager_menu) mutt_curses_set_color(MT_COLOR_NORMAL); /* clear() doesn't optimize screen redraws */ move(0, 0); - clrtobot(); + mutt_window_clrtobot(); if (IsEmail(rd->extra) && Context && ((Context->mailbox->vcount + 1) < C_PagerIndexLines)) rd->indexlen = Context->mailbox->vcount + 1;