Skip to content

Commit

Permalink
merge: upstream fixes (mutt/default)
Browse files Browse the repository at this point in the history
 * Fix mutt_refresh() pausing during macro events.
 * Add a menu stack to track current and past menus.
 * Change CurrentMenu to be controlled by the menu stack.
 * Set refresh when popping the menu stack.
 * Remove redraw parameter from crypt send_menus.
 * Don't full redraw the index when handling a command from the pager.
 * Filter other directional markers that corrupt the screen.
 * Remove the OPTFORCEREDRAW options.
 * Remove SidebarNeedsRedraw.
 * Change reflow_windows() to set full redraw.
 * Create R_MENU redraw option.
 * Remove refresh parameter from mutt_enter_fname().
  • Loading branch information
flatcap committed Apr 2, 2017
2 parents ee3fefe + 401cc3e commit 7656f1e
Show file tree
Hide file tree
Showing 44 changed files with 306 additions and 273 deletions.
5 changes: 2 additions & 3 deletions addrbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,12 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
return;
}

/* tell whoever called me to redraw the screen when I return */
set_option (OPTNEEDREDRAW);

menu = mutt_new_menu (MENU_ALIAS);
menu->make_entry = alias_entry;
menu->tag = alias_tag;
menu->title = _("Aliases");
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ALIAS, AliasHelp);
mutt_push_current_menu (menu);

new_aliases:

Expand Down Expand Up @@ -234,6 +232,7 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases)
rfc822_write_address (buf, buflen, AliasTable[t]->addr, 1);
}

mutt_pop_current_menu (menu);
mutt_menu_destroy (&menu);
FREE (&AliasTable);

Expand Down
18 changes: 7 additions & 11 deletions browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
option (OPTNEWS) ? FolderNewsHelp :
#endif
FolderHelp);
mutt_push_current_menu (menu);

init_menu (&state, menu, title, sizeof (title), buffy);

Expand Down Expand Up @@ -1451,7 +1452,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
}

destroy_state (&state);
mutt_menu_destroy (&menu);
goto bail;

case OP_BROWSER_TELL:
Expand Down Expand Up @@ -1488,7 +1488,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
menu->data = state.entry;
browser_highlight_default (&state, menu);
init_menu (&state, menu, title, sizeof (title), buffy);
MAYBE_REDRAW (menu->redraw);
}
/* else leave error on screen */
break;
Expand All @@ -1510,7 +1509,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
menu->data = state.entry;
browser_highlight_default (&state, menu);
init_menu (&state, menu, title, sizeof (title), buffy);
MAYBE_REDRAW (menu->redraw);
}
}
break;
Expand Down Expand Up @@ -1548,7 +1546,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
state.entrylen--;
mutt_message (_("Mailbox deleted."));
init_menu (&state, menu, title, sizeof (title), buffy);
MAYBE_REDRAW (menu->redraw);
}
}
else
Expand Down Expand Up @@ -1620,7 +1617,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
mutt_error (_("Error scanning directory."));
if (examine_directory (menu, &state, LastDir, prefix) == -1)
{
mutt_menu_destroy (&menu);
goto bail;
}
}
Expand All @@ -1634,7 +1630,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
mutt_perror (buf);
}
}
MAYBE_REDRAW (menu->redraw);
break;

case OP_ENTER_MASK:
Expand Down Expand Up @@ -1690,7 +1685,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
else
{
mutt_error (_("Error scanning directory."));
mutt_menu_destroy (&menu);
goto bail;
}
killPrefix = 0;
Expand All @@ -1701,7 +1695,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
}
}
}
MAYBE_REDRAW (menu->redraw);
break;

case OP_SORT:
Expand Down Expand Up @@ -1827,10 +1820,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
{
strfcpy (f, buf, flen);
destroy_state (&state);
mutt_menu_destroy (&menu);
goto bail;
}
MAYBE_REDRAW (menu->redraw);
break;

case OP_BROWSER_VIEW_FILE:
Expand All @@ -1845,7 +1836,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num
{
strfcpy (f, state.entry[menu->current].name, flen);
destroy_state (&state);
mutt_menu_destroy (&menu);
goto bail;
}
else
Expand Down Expand Up @@ -2052,6 +2042,12 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num

bail:

if (menu)
{
mutt_pop_current_menu (menu);
mutt_menu_destroy (&menu);
}

if (GotoSwapper[0])
GotoSwapper[0] = '\0';
}
3 changes: 2 additions & 1 deletion buffy.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "mx.h"

#include "mutt_curses.h"
#include "mutt_menu.h"

#ifdef USE_SIDEBAR
#include "sidebar.h"
Expand Down Expand Up @@ -420,7 +421,7 @@ static void buffy_check (BUFFY *tmp, struct stat *contex_sb, int check_stats)
(orig_count != tmp->msg_count) ||
(orig_unread != tmp->msg_unread) ||
(orig_flagged != tmp->msg_flagged))
SidebarNeedsRedraw = 1;
mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
#endif

if (!tmp->new)
Expand Down
17 changes: 9 additions & 8 deletions color.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mapping.h"

#include <string.h>
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
25 changes: 3 additions & 22 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ int mutt_display_message (HEADER *cur)
return rc;
}

void ci_bounce_message (HEADER *h, int *redraw)
void ci_bounce_message (HEADER *h)
{
char prompt[SHORT_STRING];
char scratch[SHORT_STRING];
Expand Down Expand Up @@ -284,13 +284,6 @@ void ci_bounce_message (HEADER *h, int *redraw)
strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt));

rc = mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS);

if (option (OPTNEEDREDRAW))
{
unset_option (OPTNEEDREDRAW);
*redraw = REDRAW_FULL;
}

if (rc || !buf[0])
return;

Expand Down Expand Up @@ -735,18 +728,14 @@ int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int dec
}

/* returns 0 if the copy/save was successful, or -1 on error/abort */
int mutt_save_message (HEADER *h, int delete,
int decode, int decrypt, int *redraw)
int mutt_save_message (HEADER *h, int delete, int decode, int decrypt)
{
int i, need_buffy_cleanup;
int need_passphrase = 0, app=0;
char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX];
CONTEXT ctx;
struct stat st;

*redraw = 0;


snprintf (prompt, sizeof (prompt),
decode ? (delete ? _("Decode-save%s to mailbox") :
_("Decode-copy%s to mailbox")) :
Expand Down Expand Up @@ -794,17 +783,9 @@ int mutt_save_message (HEADER *h, int delete,
}

mutt_pretty_mailbox (buf, sizeof (buf));
if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
if (mutt_enter_fname (prompt, buf, sizeof (buf), 0) == -1)
return -1;

if (*redraw != REDRAW_FULL)
{
if (!h)
*redraw = REDRAW_INDEX | REDRAW_STATUS;
else
*redraw = REDRAW_STATUS;
}

if (!buf[0])
return -1;

Expand Down
Loading

0 comments on commit 7656f1e

Please sign in to comment.