summaryrefslogtreecommitdiffstats
path: root/curs_main.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-04-05 16:09:35 -0700
committerKevin McCarthy <kevin@8t8.us>2017-04-05 16:09:35 -0700
commitec82e8d2ab6e34421931acef53ad40859151a18a (patch)
tree2e405d00633585286913c2b1d52ef3ab5cc294c2 /curs_main.c
parent19dc754d147fd4a5f3653d7068684bae9330383b (diff)
Separate out the index menu redrawing. (see #3877)
Diffstat (limited to 'curs_main.c')
-rw-r--r--curs_main.c112
1 files changed, 60 insertions, 52 deletions
diff --git a/curs_main.c b/curs_main.c
index a1b69e8d..dde3cadc 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -494,6 +494,59 @@ static const struct mapping_t IndexHelp[] = {
{ NULL, 0 }
};
+static void index_menu_redraw (MUTTMENU *menu)
+{
+ char buf[LONG_STRING];
+
+ if (menu->redraw & REDRAW_FULL)
+ {
+ menu_redraw_full (menu);
+ mutt_show_error ();
+ }
+
+#ifdef USE_SIDEBAR
+ if (menu->redraw & REDRAW_SIDEBAR)
+ {
+ mutt_sb_set_buffystats (Context);
+ menu_redraw_sidebar (menu);
+ }
+#endif
+
+ if (Context && Context->hdrs && !(menu->current >= Context->vcount))
+ {
+ menu_check_recenter (menu);
+
+ if (menu->redraw & REDRAW_INDEX)
+ {
+ menu_redraw_index (menu);
+ menu->redraw |= REDRAW_STATUS;
+ }
+ else if (menu->redraw & (REDRAW_MOTION_RESYNCH | REDRAW_MOTION))
+ menu_redraw_motion (menu);
+ else if (menu->redraw & REDRAW_CURRENT)
+ menu_redraw_current (menu);
+ }
+
+ if (menu->redraw & REDRAW_STATUS)
+ {
+ menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
+ mutt_window_move (MuttStatusWindow, 0, 0);
+ SETCOLOR (MT_COLOR_STATUS);
+ mutt_paddstr (MuttStatusWindow->cols, buf);
+ NORMAL_COLOR;
+ menu->redraw &= ~REDRAW_STATUS;
+ if (option(OPTTSENABLED) && TSSupported)
+ {
+ menu_status_line (buf, sizeof (buf), menu, NONULL (TSStatusFormat));
+ mutt_ts_status(buf);
+ menu_status_line (buf, sizeof (buf), menu, NONULL (TSIconFormat));
+ mutt_ts_icon(buf);
+ }
+ }
+
+ menu->redraw = 0;
+}
+
/* This function handles the message index window as well as commands returned
* from the pager (MENU_PAGER).
*/
@@ -519,6 +572,7 @@ int mutt_index_menu (void)
menu->color = index_color;
menu->current = ci_first_message ();
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, IndexHelp);
+ menu->custom_menu_redraw = index_menu_redraw;
mutt_push_current_menu (menu);
if (!attach_msg)
@@ -615,63 +669,19 @@ int mutt_index_menu (void)
if (menu->menu == MENU_MAIN)
{
- if (menu->redraw & REDRAW_FULL)
- {
- menu_redraw_full (menu);
- mutt_show_error ();
- }
-
-#ifdef USE_SIDEBAR
- if (menu->redraw & REDRAW_SIDEBAR)
- {
- mutt_sb_set_buffystats (Context);
- menu_redraw_sidebar (menu);
- }
-#endif
- if (Context && Context->hdrs && !(menu->current >= Context->vcount))
- {
- menu_check_recenter (menu);
-
- if (menu->redraw & REDRAW_INDEX)
- {
- menu_redraw_index (menu);
- menu->redraw |= REDRAW_STATUS;
- }
- else if (menu->redraw & (REDRAW_MOTION_RESYNCH | REDRAW_MOTION))
- menu_redraw_motion (menu);
- else if (menu->redraw & REDRAW_CURRENT)
- menu_redraw_current (menu);
- }
+ index_menu_redraw (menu);
- if (menu->redraw & REDRAW_STATUS)
- {
- menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
- mutt_window_move (MuttStatusWindow, 0, 0);
- SETCOLOR (MT_COLOR_STATUS);
- mutt_paddstr (MuttStatusWindow->cols, buf);
- NORMAL_COLOR;
- menu->redraw &= ~REDRAW_STATUS;
- if (option(OPTTSENABLED) && TSSupported)
- {
- menu_status_line (buf, sizeof (buf), menu, NONULL (TSStatusFormat));
- mutt_ts_status(buf);
- menu_status_line (buf, sizeof (buf), menu, NONULL (TSIconFormat));
- mutt_ts_icon(buf);
- }
- }
-
- menu->redraw = 0;
if (menu->current < menu->max)
- menu->oldcurrent = menu->current;
+ menu->oldcurrent = menu->current;
else
- menu->oldcurrent = -1;
+ menu->oldcurrent = -1;
if (option (OPTARROWCURSOR))
- mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset, 2);
+ mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset, 2);
else if (option (OPTBRAILLEFRIENDLY))
- mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset, 0);
+ mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset, 0);
else
- mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset,
+ mutt_window_move (MuttIndexWindow, menu->current - menu->top + menu->offset,
MuttIndexWindow->cols - 1);
mutt_refresh ();
@@ -680,8 +690,6 @@ int mutt_index_menu (void)
{
mutt_flushinp ();
mutt_resize_screen ();
- menu->redraw = REDRAW_FULL;
- menu->menu = MENU_MAIN;
SigWinch = 0;
menu->top = 0; /* so we scroll the right amount */
/*