Commit 107e64ca authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Remove the OPTFORCEREDRAW options.

Use the menu stack to flag redraws for the index and pager.
parent a6d0c401
......@@ -22,6 +22,7 @@
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mapping.h"
#include <string.h>
......@@ -494,7 +495,7 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data,
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;
......@@ -771,7 +772,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
else if (object == MT_COLOR_INDEX)
{
r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1);
set_option (OPTFORCEREDRAWINDEX);
mutt_set_menu_redraw_full (MENU_MAIN);
}
else if (object == MT_COLOR_QUOTED)
{
......
......@@ -94,7 +94,7 @@ void mutt_need_hard_redraw (void)
{
keypad (stdscr, TRUE);
clearok (stdscr, TRUE);
mutt_set_current_menu_redraw ();
mutt_set_current_menu_redraw_full ();
}
event_t mutt_getch (void)
......
......@@ -2053,10 +2053,6 @@ int mutt_index_menu (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:
......
......@@ -1291,8 +1291,8 @@ static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER
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;
}
......@@ -1436,7 +1436,7 @@ static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er
{
for (tmp = Aliases; tmp ; tmp = tmp->next)
tmp->del = 1;
set_option (OPTFORCEREDRAWINDEX);
mutt_set_current_menu_redraw_full ();
}
else
mutt_free_alias (&Aliases);
......@@ -1450,7 +1450,7 @@ static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er
if (CurrentMenu == MENU_ALIAS)
{
tmp->del = 1;
set_option (OPTFORCEREDRAWINDEX);
mutt_set_current_menu_redraw_full ();
break;
}
......@@ -1511,7 +1511,7 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
/* 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);
......@@ -1789,9 +1789,9 @@ static void mutt_restore_default (struct option_t *p)
}
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)
......@@ -1972,8 +1972,7 @@ static int parse_setenv(BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
if (found)
{
set_option (OPTFORCEREDRAWINDEX);
set_option (OPTFORCEREDRAWPAGER);
mutt_set_current_menu_redraw_full ();
mutt_any_key_to_continue (NULL);
return 0;
}
......@@ -2102,8 +2101,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
}
for (idx = 0; MuttVars[idx].option; idx++)
mutt_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);
......@@ -2569,9 +2567,9 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
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)
......
......@@ -774,7 +774,16 @@ void mutt_pop_current_menu (MUTTMENU *menu)
}
}
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;
......@@ -783,6 +792,12 @@ void mutt_set_current_menu_redraw (void)
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
......@@ -1088,12 +1103,6 @@ int mutt_menuLoop (MUTTMENU *menu)
case OP_ENTER_COMMAND:
mutt_enter_command ();
if (option (OPTFORCEREDRAWINDEX))
{
menu->redraw = REDRAW_FULL;
unset_option (OPTFORCEREDRAWINDEX);
unset_option (OPTFORCEREDRAWPAGER);
}
break;
case OP_TAG:
......
......@@ -531,8 +531,6 @@ enum
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 */
......
......@@ -122,7 +122,9 @@ MUTTMENU *mutt_new_menu (int);
void mutt_menuDestroy (MUTTMENU **);
void mutt_push_current_menu (MUTTMENU *);
void mutt_pop_current_menu (MUTTMENU *);
void mutt_set_current_menu_redraw ();
void mutt_set_current_menu_redraw (int);
void mutt_set_current_menu_redraw_full ();
void mutt_set_menu_redraw_full (int);
int mutt_menuLoop (MUTTMENU *);
/* used in both the index and pager index to make an entry. */
......
......@@ -2566,10 +2566,6 @@ search_next:
ch = 0;
}
if (option (OPTFORCEREDRAWPAGER))
pager_menu->redraw = REDRAW_FULL;
unset_option (OPTFORCEREDRAWINDEX);
unset_option (OPTFORCEREDRAWPAGER);
break;
case OP_FLAG_MESSAGE:
......
......@@ -21,6 +21,7 @@
#endif
#include "mutt.h"
#include "mutt_menu.h"
#include "sort.h"
#include <string.h>
#include <stdlib.h>
......@@ -51,8 +52,8 @@ void mutt_check_rescore (CONTEXT *ctx)
}
/* 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++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment