mutt_window_t *MuttSidebarWindow = NULL;
#endif
+static void reflow_message_window_rows(int mw_rows);
+
+
void mutt_refresh(void)
{
/* don't refresh when we are waiting for a child. */
char *yes = _("yes");
char *no = _("no");
char *answer_string = NULL;
- size_t answer_string_len;
- size_t msglen;
+ int answer_string_wid, msg_wid;
+ size_t trunc_msg_len;
+ int redraw = 1, prompt_lines = 1;
#ifdef HAVE_LANGINFO_YESEXPR
char *expr = NULL;
!REGCOMP(&reno, expr, REG_NOSUB);
#endif
- mutt_window_clearline(MuttMessageWindow, 0);
-
/*
* In order to prevent the default answer to the question to wrapped
* around the screen in the even the question is wider than the screen,
*/
safe_asprintf(&answer_string, " ([%s]/%s): ", def == MUTT_YES ? yes : no,
def == MUTT_YES ? no : yes);
- answer_string_len = mutt_strwidth(answer_string);
- /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */
- msglen = mutt_wstr_trunc(msg, 4 * MuttMessageWindow->cols,
- MuttMessageWindow->cols - answer_string_len, NULL);
- SETCOLOR(MT_COLOR_PROMPT);
- addnstr(msg, msglen);
- addstr(answer_string);
- NORMAL_COLOR;
- FREE(&answer_string);
+ answer_string_wid = mutt_strwidth(answer_string);
+ msg_wid = mutt_strwidth(msg);
while (true)
{
+ if (redraw || SigWinch)
+ {
+ redraw = 0;
+#if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM)
+ if (SigWinch)
+ {
+ SigWinch = 0;
+ mutt_resize_screen();
+ clearok(stdscr, TRUE);
+ mutt_current_menu_redraw();
+ }
+#endif
+ if (MuttMessageWindow->cols)
+ {
+ prompt_lines = (msg_wid + answer_string_wid + MuttMessageWindow->cols - 1) /
+ MuttMessageWindow->cols;
+ prompt_lines = MAX(1, MIN(3, prompt_lines));
+ }
+ if (prompt_lines != MuttMessageWindow->rows)
+ {
+ reflow_message_window_rows(prompt_lines);
+ mutt_current_menu_redraw();
+ }
+
+ /* maxlen here is sort of arbitrary, so pick a reasonable upper bound */
+ trunc_msg_len = mutt_wstr_trunc(
+ msg, 4 * prompt_lines * MuttMessageWindow->cols,
+ prompt_lines * MuttMessageWindow->cols - answer_string_wid, NULL);
+
+ mutt_window_move(MuttMessageWindow, 0, 0);
+ SETCOLOR(MT_COLOR_PROMPT);
+ addnstr(msg, trunc_msg_len);
+ addstr(answer_string);
+ NORMAL_COLOR;
+ mutt_window_clrtoeol(MuttMessageWindow);
+ }
+
mutt_refresh();
+ /* SigWinch is not processed unless timeout is set */
+ timeout(30 * 1000);
ch = mutt_getch();
+ timeout(-1);
+ if (ch.ch == -2)
+ continue;
if (CI_is_return(ch.ch))
break;
if (ch.ch < 0)
}
}
+ FREE(&answer_string);
+
#ifdef HAVE_LANGINFO_YESEXPR
if (reyes_ok)
regfree(&reyes);
regfree(&reno);
#endif
+ if (MuttMessageWindow->rows != 1)
+ {
+ reflow_message_window_rows(1);
+ mutt_current_menu_redraw();
+ }
+ else
+ mutt_window_clearline(MuttMessageWindow, 0);
+
if (def != MUTT_ABORT)
{
addstr((char *) (def == MUTT_YES ? yes : no));