changeset: 7007:24e38e932693 user: Kevin McCarthy <ke...@8t8.us> date: Sat Apr 15 12:56:42 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/24e38e932693
Add ifdefs around new mutt_resize_screen calls. Changeset 231fa2eff206 added sigwinch handling to _mutt_enter_string() but neglected to add an ifdef check. changeset: 7008:5849d1a052bb user: Kevin McCarthy <ke...@8t8.us> date: Sat Apr 15 12:56:43 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/5849d1a052bb Add multiline and sigwinch handling to mutt_multi_choice. (see #3877) Resize the message window up to three lines to fix wide prompts. Enable sigwinch processing and redraw the current menu as needed. changeset: 7009:2be3dd383c35 user: Kevin McCarthy <ke...@8t8.us> date: Sat Apr 15 12:56:46 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/2be3dd383c35 Set pager's REDRAW_SIGWINCH when reflowing windows. So that all external reflow handling functions don't have to remember to set the flag too. diffs (153 lines): diff -r 39bf12dccf0c -r 2be3dd383c35 curs_lib.c --- a/curs_lib.c Wed Apr 12 18:00:22 2017 -0700 +++ b/curs_lib.c Sat Apr 15 12:56:46 2017 -0700 @@ -162,16 +162,15 @@ do { +#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) if (SigWinch) { SigWinch = 0; mutt_resize_screen (); - /* mutt_resize_screen sets REDRAW_FULL, but the pager also - * requires SIGWINCH. */ - mutt_set_current_menu_redraw (REDRAW_SIGWINCH); clearok(stdscr, TRUE); mutt_current_menu_redraw (); } +#endif mutt_window_clearline (MuttMessageWindow, 0); SETCOLOR (MT_COLOR_PROMPT); addstr ((char *)field); /* cast to get around bad prototypes */ @@ -560,6 +559,31 @@ #endif mutt_set_current_menu_redraw_full (); + /* the pager menu needs this flag set to recalc lineInfo */ + mutt_set_current_menu_redraw (REDRAW_SIGWINCH); +} + +static void reflow_message_window_rows (int mw_rows) +{ + MuttMessageWindow->rows = mw_rows; + MuttMessageWindow->row_offset = LINES - mw_rows; + + MuttStatusWindow->row_offset = option (OPTSTATUSONTOP) ? 0 : LINES - mw_rows - 1; + + if (option (OPTHELP)) + MuttHelpWindow->row_offset = option (OPTSTATUSONTOP) ? LINES - mw_rows - 1 : 0; + + MuttIndexWindow->rows = MAX(LINES - MuttStatusWindow->rows - + MuttHelpWindow->rows - MuttMessageWindow->rows, 0); + +#ifdef USE_SIDEBAR + if (option (OPTSIDEBAR)) + MuttSidebarWindow->rows = MuttIndexWindow->rows; +#endif + + /* We don't also set REDRAW_SIGWINCH because this function only + * changes rows and is a temporary adjustment. */ + mutt_set_current_menu_redraw_full (); } int mutt_window_move (mutt_window_t *win, int row, int col) @@ -869,16 +893,48 @@ { event_t ch; int choice; + int redraw = 1, prompt_lines = 1; char *p; - SETCOLOR (MT_COLOR_PROMPT); - mutt_window_mvaddstr (MuttMessageWindow, 0, 0, prompt); - NORMAL_COLOR; - mutt_window_clrtoeol (MuttMessageWindow); FOREVER { + 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 = (mutt_strwidth (prompt) + 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 (); + } + + SETCOLOR (MT_COLOR_PROMPT); + mutt_window_mvaddstr (MuttMessageWindow, 0, 0, prompt); + 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; /* (ch.ch == 0) is technically possible. Treat the same as < 0 (abort) */ if (ch.ch <= 0 || CI_is_return (ch.ch)) { @@ -902,7 +958,13 @@ } BEEP (); } - mutt_window_clearline (MuttMessageWindow, 0); + if (MuttMessageWindow->rows != 1) + { + reflow_message_window_rows (1); + mutt_current_menu_redraw (); + } + else + mutt_window_clearline (MuttMessageWindow, 0); mutt_refresh (); return choice; } diff -r 39bf12dccf0c -r 2be3dd383c35 enter.c --- a/enter.c Wed Apr 12 18:00:22 2017 -0700 +++ b/enter.c Sat Apr 15 12:56:46 2017 -0700 @@ -218,12 +218,14 @@ ENTER_STATE *es = mutt_new_enter_state (); do { +#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) if (SigWinch) { SigWinch = 0; mutt_resize_screen (); clearok(stdscr, TRUE); } +#endif rv = _mutt_enter_string (buf, buflen, col, flags, 0, NULL, NULL, es); } while (rv == 1); diff -r 39bf12dccf0c -r 2be3dd383c35 pager.c --- a/pager.c Wed Apr 12 18:00:22 2017 -0700 +++ b/pager.c Sat Apr 15 12:56:46 2017 -0700 @@ -2029,7 +2029,8 @@ } else { - pager_menu->redraw = REDRAW_FULL | REDRAW_SIGWINCH; + /* note: mutt_resize_screen() -> mutt_reflow_windows() sets + * REDRAW_FULL and REDRAW_SIGWINCH */ ch = 0; } continue;