mutt_allow_interrupt (0);
if (SigInt)
+ {
mutt_query_exit ();
+ return err;
+ }
if(ch == ERR)
{
answer[1] = 0;
reyes_ok = (expr = nl_langinfo (YESEXPR)) && expr[0] == '^' &&
- !regcomp (&reyes, expr, REG_NOSUB|REG_EXTENDED);
+ !REGCOMP (&reyes, expr, REG_NOSUB);
reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' &&
- !regcomp (&reno, expr, REG_NOSUB|REG_EXTENDED);
+ !REGCOMP (&reno, expr, REG_NOSUB);
#endif
CLEARLINE(LINES-1);
answer_string = safe_malloc (COLS + 1);
snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no, def == M_YES ? no : yes);
answer_string_len = strlen (answer_string);
- printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
+ mutt_message ("%.*s%s", COLS - answer_string_len, msg, answer_string);
FREE (&answer_string);
FOREVER
addstr ((char *) (def == M_YES ? yes : no));
mutt_refresh ();
}
+ else
+ {
+ /* when the users cancels with ^G, clear the message stored with
+ * mutt_message() so it isn't displayed when the screen is refreshed. */
+ mutt_clear_error();
+ }
return (def);
}
SigInt = 0;
}
-void mutt_curses_error (const char *fmt, ...)
+static void curses_message (int error, const char *fmt, va_list ap)
{
- va_list ap;
char scratch[LONG_STRING];
- va_start (ap, fmt);
vsnprintf (scratch, sizeof (scratch), fmt, ap);
- va_end (ap);
-
+
dprint (1, (debugfile, "%s\n", scratch));
mutt_format_string (Errorbuf, sizeof (Errorbuf),
- 0, COLS-2, FMT_LEFT, 0, scratch, sizeof (scratch), 0);
+ 0, COLS, FMT_LEFT, 0, scratch, sizeof (scratch), 0);
if (!option (OPTKEEPQUIET))
{
- BEEP ();
- SETCOLOR (MT_COLOR_ERROR);
+ if (error)
+ BEEP ();
+ SETCOLOR (error ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
mvaddstr (LINES-1, 0, Errorbuf);
clrtoeol ();
SETCOLOR (MT_COLOR_NORMAL);
mutt_refresh ();
}
- set_option (OPTMSGERR);
+ if (error)
+ set_option (OPTMSGERR);
+ else
+ unset_option (OPTMSGERR);
}
-void mutt_curses_message (const char *fmt, ...)
+void mutt_curses_error (const char *fmt, ...)
{
va_list ap;
- char scratch[LONG_STRING];
va_start (ap, fmt);
- vsnprintf (scratch, sizeof (scratch), fmt, ap);
+ curses_message (1, fmt, ap);
va_end (ap);
+}
- mutt_format_string (Errorbuf, sizeof (Errorbuf),
- 0, COLS-2, FMT_LEFT, 0, scratch, sizeof (scratch), 0);
-
- if (!option (OPTKEEPQUIET))
- {
- SETCOLOR (MT_COLOR_MESSAGE);
- mvaddstr (LINES - 1, 0, Errorbuf);
- clrtoeol ();
- SETCOLOR (MT_COLOR_NORMAL);
- mutt_refresh ();
- }
+void mutt_curses_message (const char *fmt, ...)
+{
+ va_list ap;
- unset_option (OPTMSGERR);
+ va_start (ap, fmt);
+ curses_message (0, fmt, ap);
+ va_end (ap);
}
void mutt_progress_init (progress_t* progress, const char *msg,
w = 1; /* hack */
else
{
+#ifdef HAVE_ISWBLANK
+ if (iswblank (wc))
+ wc = ' ';
+ else
+#endif
if (!IsWPrint (wc))
wc = '?';
w = wcwidth (wc);
min_width -= w;
max_width -= w;
strncpy (p, scratch, k2);
- p += k2;
+ p += k2;
destlen -= k2;
}
}
{
wchar_t wc;
int w = 0, l = 0, cl;
- size_t cw, n;
+ int cw, n;
mbstate_t mbstate;
if (!src)
if (cl == (size_t)(-1) || cl == (size_t)(-2))
cw = cl = 1;
else
+ {
cw = wcwidth (wc);
+ /* hack because M_TREE symbols aren't turned into characters
+ * until rendered by print_enriched_string (#3364) */
+ if (cw < 0 && cl == 1 && src[0] && src[0] < M_TREE_MAX)
+ cw = 1;
+ }
if (cl + l > maxlen || cw + w > maxwid)
break;
l += cl;