From: Kevin McCarthy Date: Sat, 1 Apr 2017 01:15:12 +0000 (-0700) Subject: Remove the OPTFORCEREDRAW options. X-Git-Tag: neomutt-20170414~18^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=97d731ecb2851b64c3c39722d0ce9246dbfd7384;p=neomutt Remove the OPTFORCEREDRAW options. Use the menu stack to flag redraws for the index and pager. --- diff --git a/color.c b/color.c index abec4ee80..7a503d51b 100644 --- a/color.c +++ b/color.c @@ -19,6 +19,7 @@ #include "mutt.h" #include "mutt_curses.h" +#include "mutt_menu.h" #include "mapping.h" #include @@ -459,7 +460,7 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, if (object > MT_COLOR_INDEX_SUBJECT) { /* uncolor index column */ ColorDefs[object] = 0; - set_option (OPTFORCEREDRAWINDEX); + mutt_set_menu_redraw_full (MENU_MAIN); return 0; } @@ -524,7 +525,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; @@ -856,32 +857,32 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, { 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) @@ -912,7 +913,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, { 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; diff --git a/curs_lib.c b/curs_lib.c index 42cdace2a..b006f56ea 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -98,7 +98,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) diff --git a/curs_main.c b/curs_main.c index c40e70a3b..afe072c8c 100644 --- a/curs_main.c +++ b/curs_main.c @@ -2788,10 +2788,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: diff --git a/init.c b/init.c index c62f8dad5..c550695f8 100644 --- a/init.c +++ b/init.c @@ -1524,8 +1524,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; } @@ -1669,7 +1669,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); @@ -1683,7 +1683,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; } @@ -1744,7 +1744,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); @@ -1998,9 +1998,9 @@ static void 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) @@ -2188,8 +2188,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; } @@ -2318,8 +2317,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) } 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); @@ -2779,9 +2777,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) diff --git a/menu.c b/menu.c index 0024614c9..829d42ff0 100644 --- a/menu.c +++ b/menu.c @@ -839,7 +839,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; @@ -848,6 +857,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 @@ -1162,12 +1177,6 @@ int mutt_menu_loop (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: diff --git a/mutt.h b/mutt.h index 91dff1d3e..8030a530b 100644 --- a/mutt.h +++ b/mutt.h @@ -573,8 +573,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 */ diff --git a/mutt_menu.h b/mutt_menu.h index 5940843b8..74755ccc3 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -121,7 +121,9 @@ MUTTMENU *mutt_new_menu(int menu); 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. */ diff --git a/pager.c b/pager.c index 3c9ff1080..7edd4099d 100644 --- a/pager.c +++ b/pager.c @@ -2754,10 +2754,6 @@ search_next: ch = 0; } - if (option (OPTFORCEREDRAWPAGER)) - pager_menu->redraw = REDRAW_FULL; - unset_option (OPTFORCEREDRAWINDEX); - unset_option (OPTFORCEREDRAWPAGER); break; case OP_FLAG_MESSAGE: diff --git a/score.c b/score.c index 64d02632e..d3da8b11e 100644 --- a/score.c +++ b/score.c @@ -18,6 +18,7 @@ #include "config.h" #include "mutt.h" +#include "mutt_menu.h" #include "sort.h" #include #include @@ -48,8 +49,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++) {