Encapsulate a curses function to reduce dependencies.
void mutt_need_hard_redraw(void)
{
keypad(stdscr, true);
- clearok(stdscr, true);
+ mutt_window_clear_screen();
mutt_menu_set_current_redraw_full();
}
{
SigWinch = 0;
mutt_resize_screen();
- clearok(stdscr, true);
+ mutt_window_clear_screen();
mutt_menu_current_redraw();
}
mutt_window_clearline(MuttMessageWindow, 0);
/* the terminal may have been resized while the editor owned it */
mutt_resize_screen();
keypad(stdscr, true);
- clearok(stdscr, true);
+ mutt_window_clear_screen();
mutt_buffer_pool_release(&cmd);
}
{
SigWinch = 0;
mutt_resize_screen();
- clearok(stdscr, true);
+ mutt_window_clear_screen();
mutt_menu_current_redraw();
}
if (MuttMessageWindow->cols)
{
SigWinch = 0;
mutt_resize_screen();
- clearok(stdscr, true);
+ mutt_window_clear_screen();
mutt_menu_current_redraw();
}
if (MuttMessageWindow->cols)
{
SigWinch = 0;
mutt_resize_screen();
- clearok(stdscr, true);
+ mutt_window_clear_screen();
}
rc = mutt_enter_string_full(buf, buflen, col, flags, false, NULL, NULL, es);
} while (rc == 1);
*/
void mutt_draw_statusline(int cols, const char *buf, size_t buflen)
{
+ if (!buf)
+ return;
+
size_t i = 0;
size_t offset = 0;
bool found = false;
int last;
} *syntax = NULL;
- if (!buf || !stdscr)
- return;
-
do
{
struct ColorLine *cl = NULL;
menu->top = 0; /* so we scroll the right amount */
/* force a real complete redraw. clrtobot() doesn't seem to be able
* to handle every case without this. */
- clearok(stdscr, true);
+ mutt_window_clear_screen();
continue;
}
break;
case OP_REDRAW:
- clearok(stdscr, true);
+ mutt_window_clear_screen();
menu->redraw = REDRAW_FULL;
break;
void menu_redraw_full(struct Menu *menu)
{
mutt_curses_set_color(MT_COLOR_NORMAL);
- /* clear() doesn't optimize screen redraws */
- mutt_window_move_abs(0, 0);
- mutt_window_clrtobot();
+ mutt_window_clear_screen();
if (C_Help)
{
else
{
CurrentMenu = MENU_MAIN;
- mutt_window_move_abs(0, 0);
- mutt_window_clrtobot();
+ mutt_window_clear_screen();
}
}
{
mutt_resize_screen();
SigWinch = 0;
- clearok(stdscr, true); /* force complete redraw */
+ mutt_window_clear_screen();
}
if (i < 0)
break;
case OP_REDRAW:
- clearok(stdscr, true);
+ mutt_window_clear_screen();
menu->redraw = REDRAW_FULL;
break;
#include "config.h"
#include <stdarg.h>
+#include <stdbool.h>
#include <string.h>
#include "mutt/mutt.h"
#include "mutt_window.h"
return rc;
}
+
+/**
+ * mutt_window_clear_screen - Clear the entire screen
+ */
+void mutt_window_clear_screen(void)
+{
+ clearok(stdscr, true);
+}
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_clear_screen(void);
void mutt_window_clearline(struct MuttWindow *win, int row);
void mutt_window_clrtobot (void);
void mutt_window_clrtoeol (struct MuttWindow *win);
if (pager_menu->redraw & REDRAW_FULL)
{
mutt_curses_set_color(MT_COLOR_NORMAL);
- /* clear() doesn't optimize screen redraws */
- mutt_window_move_abs(0, 0);
- mutt_window_clrtobot();
+ mutt_window_clear_screen();
if (IsEmail(rd->extra) && Context && ((Context->mailbox->vcount + 1) < C_PagerIndexLines))
rd->indexlen = Context->mailbox->vcount + 1;
{
SigWinch = 0;
mutt_resize_screen();
- clearok(stdscr, true); /* force complete redraw */
+ mutt_window_clear_screen();
if (flags & MUTT_PAGER_RETWINCH)
{
break;
case OP_REDRAW:
- clearok(stdscr, true);
+ mutt_window_clear_screen();
pager_menu->redraw = REDRAW_FULL;
break;