summaryrefslogtreecommitdiffstats
path: root/curs_lib.c
diff options
context:
space:
mode:
authorRocco Rutte <pdmef@gmx.net>2009-06-22 17:36:21 +0200
committerRocco Rutte <pdmef@gmx.net>2009-06-22 17:36:21 +0200
commit3813c6a0aa6a43f5f33a2272eea2f88fbbbc6e5b (patch)
treefc1b412a9dcaf828c66a6fdfef66ebb1e5971ac1 /curs_lib.c
parentbfddfb411272a9f5da7139a50b23ea939aac9d34 (diff)
Make mutt_curses_(error|message) format message to COLS chars. Closes #3278.
While I'm at it, fold both functions into one.
Diffstat (limited to 'curs_lib.c')
-rw-r--r--curs_lib.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/curs_lib.c b/curs_lib.c
index 2427e609..47ccb08c 100644
--- a/curs_lib.c
+++ b/curs_lib.c
@@ -295,54 +295,48 @@ void mutt_query_exit (void)
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);
+ 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,