Use the menu stack to flag redraws for the index and pager.
#include "mutt.h"
#include "mutt_curses.h"
+#include "mutt_menu.h"
#include "mapping.h"
#include <string.h>
if (object > MT_COLOR_INDEX_SUBJECT) { /* uncolor index column */
ColorDefs[object] = 0;
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
return 0;
}
if (do_cache && !option (OPTNOCURSES))
{
int i;
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
/* force re-caching of index colors */
for (i = 0; Context && i < Context->msgcount; i++)
Context->hdrs[i]->pair = 0;
{
r = add_pattern (&ColorIndexList, buf->data, 1,
fg, bg, attr, err, 1, match);
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_AUTHOR)
{
r = add_pattern (&ColorIndexAuthorList, buf->data, 1,
fg, bg, attr, err, 1, match);
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_FLAGS)
{
r = add_pattern (&ColorIndexFlagsList, buf->data, 1,
fg, bg, attr, err, 1, match);
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_SUBJECT)
{
r = add_pattern (&ColorIndexSubjectList, buf->data, 1,
fg, bg, attr, err, 1, match);
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
#ifdef USE_NOTMUCH
else if (object == MT_COLOR_INDEX_TAG)
{
r = add_pattern (&ColorIndexTagList, buf->data, 1,
fg, bg, attr, err, 1, match);
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
#endif
else if (object == MT_COLOR_QUOTED)
{
ColorDefs[object] = fgbgattr_to_color(fg, bg, attr);
if (object > MT_COLOR_INDEX_AUTHOR)
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
}
return r;
{
keypad (stdscr, true);
clearok (stdscr, true);
- mutt_set_current_menu_redraw ();
+ mutt_set_current_menu_redraw_full ();
}
event_t mutt_getch (void)
mutt_enter_command ();
mutt_check_rescore (Context);
- if (option (OPTFORCEREDRAWINDEX))
- menu->redraw = REDRAW_FULL;
- unset_option (OPTFORCEREDRAWINDEX);
- unset_option (OPTFORCEREDRAWPAGER);
break;
case OP_EDIT_MESSAGE:
print_attach_list(AttachExclude, '-', "A");
print_attach_list(InlineAllow, '+', "I");
print_attach_list(InlineExclude, '-', "I");
- set_option (OPTFORCEREDRAWINDEX);
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_menu_redraw_full (MENU_MAIN);
+ mutt_set_menu_redraw_full (MENU_PAGER);
mutt_any_key_to_continue (NULL);
return 0;
}
{
for (tmp = Aliases; tmp ; tmp = tmp->next)
tmp->del = 1;
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_current_menu_redraw_full ();
}
else
mutt_free_alias (&Aliases);
if (CurrentMenu == MENU_ALIAS)
{
tmp->del = 1;
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_current_menu_redraw_full ();
break;
}
/* override the previous value */
rfc822_free_address (&tmp->addr);
if (CurrentMenu == MENU_ALIAS)
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_current_menu_redraw_full ();
}
mutt_extract_token (buf, s, MUTT_TOKEN_QUOTE | MUTT_TOKEN_SPACE | MUTT_TOKEN_SEMICOLON);
}
if (p->flags & R_INDEX)
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
if (p->flags & R_PAGER)
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_menu_redraw_full (MENU_PAGER);
if (p->flags & R_RESORT_SUB)
set_option (OPTSORTSUBTHREADS);
if (p->flags & R_RESORT)
if (found)
{
- set_option (OPTFORCEREDRAWINDEX);
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_current_menu_redraw_full ();
mutt_any_key_to_continue (NULL);
return 0;
}
}
for (idx = 0; MuttVars[idx].option; idx++)
restore_default (&MuttVars[idx]);
- set_option (OPTFORCEREDRAWINDEX);
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_current_menu_redraw_full ();
set_option (OPTSORTSUBTHREADS);
set_option (OPTNEEDRESORT);
set_option (OPTRESORTINIT);
if (!myvar)
{
if (MuttVars[idx].flags & R_INDEX)
- set_option (OPTFORCEREDRAWINDEX);
+ mutt_set_menu_redraw_full (MENU_MAIN);
if (MuttVars[idx].flags & R_PAGER)
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_menu_redraw_full (MENU_PAGER);
if (MuttVars[idx].flags & R_RESORT_SUB)
set_option (OPTSORTSUBTHREADS);
if (MuttVars[idx].flags & R_RESORT)
}
}
-void mutt_set_current_menu_redraw (void)
+void mutt_set_current_menu_redraw (int redraw)
+{
+ MUTTMENU *current_menu;
+
+ current_menu = get_current_menu ();
+ if (current_menu)
+ current_menu->redraw |= redraw;
+}
+
+void mutt_set_current_menu_redraw_full (void)
{
MUTTMENU *current_menu;
current_menu->redraw = REDRAW_FULL;
}
+void mutt_set_menu_redraw_full (int menu_type)
+{
+ if (CurrentMenu == menu_type)
+ mutt_set_current_menu_redraw_full ();
+}
+
#define MUTT_SEARCH_UP 1
#define MUTT_SEARCH_DOWN 2
case OP_ENTER_COMMAND:
mutt_enter_command ();
- if (option (OPTFORCEREDRAWINDEX))
- {
- menu->redraw = REDRAW_FULL;
- unset_option (OPTFORCEREDRAWINDEX);
- unset_option (OPTFORCEREDRAWPAGER);
- }
break;
case OP_TAG:
OPTNEEDRESORT, /* (pseudo) used to force a re-sort */
OPTRESORTINIT, /* (pseudo) used to force the next resort to be from scratch */
OPTVIEWATTACH, /* (pseudo) signals that we are viewing attachments */
- OPTFORCEREDRAWINDEX, /* (pseudo) used to force a redraw in the main index */
- OPTFORCEREDRAWPAGER, /* (pseudo) used to force a redraw in the pager */
OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
OPTATTACHMSG, /* (pseudo) used by attach-message */
void mutt_menu_destroy(MUTTMENU **p);
void mutt_push_current_menu (MUTTMENU *);
void mutt_pop_current_menu (MUTTMENU *);
-void mutt_set_current_menu_redraw (void);
+void mutt_set_current_menu_redraw (int redraw);
+void mutt_set_current_menu_redraw_full ();
+void mutt_set_menu_redraw_full (int);
int mutt_menu_loop(MUTTMENU *menu);
/* used in both the index and pager index to make an entry. */
ch = 0;
}
- if (option (OPTFORCEREDRAWPAGER))
- pager_menu->redraw = REDRAW_FULL;
- unset_option (OPTFORCEREDRAWINDEX);
- unset_option (OPTFORCEREDRAWPAGER);
break;
case OP_FLAG_MESSAGE:
#include "config.h"
#include "mutt.h"
+#include "mutt_menu.h"
#include "sort.h"
#include <string.h>
#include <stdlib.h>
}
/* must redraw the index since the user might have %N in it */
- set_option (OPTFORCEREDRAWINDEX);
- set_option (OPTFORCEREDRAWPAGER);
+ mutt_set_menu_redraw_full (MENU_MAIN);
+ mutt_set_menu_redraw_full (MENU_PAGER);
for (i = 0; ctx && i < ctx->msgcount; i++)
{