diff options
-rw-r--r-- | curs_lib.c | 9 | ||||
-rw-r--r-- | enter.c | 30 | ||||
-rw-r--r-- | keymap.c | 4 | ||||
-rw-r--r-- | menu.c | 17 | ||||
-rw-r--r-- | mutt_menu.h | 1 |
5 files changed, 51 insertions, 10 deletions
@@ -162,6 +162,13 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, do { + if (SigWinch) + { + SigWinch = 0; + mutt_resize_screen (); + clearok(stdscr, TRUE); + mutt_current_menu_redraw (); + } mutt_window_clearline (MuttMessageWindow, 0); SETCOLOR (MT_COLOR_PROMPT); addstr ((char *)field); /* cast to get around bad prototypes */ @@ -173,7 +180,7 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, while (ret == 1); mutt_window_clearline (MuttMessageWindow, 0); mutt_free_enter_state (&es); - + return (ret); } @@ -203,22 +203,40 @@ static inline int is_shell_char(wchar_t ch) return wcschr(shell_chars, ch) != NULL; } -/* +/* This function is for very basic input, currently used only by the + * built-in editor. It does not handle screen redrawing on resizes + * well, because there is no active menu for the built-in editor. + * Most callers should prefer mutt_get_field() instead. + * * Returns: - * 1 need to redraw the screen and call me again * 0 if input was given * -1 if abort. */ - int mutt_enter_string(char *buf, size_t buflen, int col, int flags) { int rv; ENTER_STATE *es = mutt_new_enter_state (); - rv = _mutt_enter_string (buf, buflen, col, flags, 0, NULL, NULL, es); + do + { + if (SigWinch) + { + SigWinch = 0; + mutt_resize_screen (); + clearok(stdscr, TRUE); + } + rv = _mutt_enter_string (buf, buflen, col, flags, 0, NULL, NULL, es); + } + while (rv == 1); mutt_free_enter_state (&es); return rv; } +/* + * Returns: + * 1 need to redraw the screen and call me again + * 0 if input was given + * -1 if abort. + */ int _mutt_enter_string (char *buf, size_t buflen, int col, int flags, int multiple, char ***files, int *numfiles, ENTER_STATE *state) @@ -297,7 +315,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, if ((ch = km_dokey (MENU_EDITOR)) == -1) { - rv = -1; + rv = SigWinch ? 1 : -1; goto bye; } @@ -785,7 +803,7 @@ self_insert: } bye: - + mutt_reset_history_state (hclass); FREE (&tempbuf); return rv; @@ -464,8 +464,8 @@ int km_dokey (int menu) #ifdef USE_IMAP gotkey: #endif - /* hide timeouts and window resizes from line editor. */ - if (menu == MENU_EDITOR && tmp.ch == -2) + /* hide timeouts, but not window resizes, from the line editor. */ + if (menu == MENU_EDITOR && tmp.ch == -2 && !SigWinch) continue; LastKey = tmp.ch; @@ -798,6 +798,22 @@ void mutt_set_menu_redraw_full (int menu_type) mutt_set_current_menu_redraw_full (); } +void mutt_current_menu_redraw () +{ + MUTTMENU *current_menu; + + current_menu = get_current_menu (); + if (current_menu) + { + if (menu_redraw (current_menu) == OP_REDRAW) + /* On a REDRAW_FULL with a non-customized redraw, menu_redraw() + * will return OP_REDRAW to give the calling menu-loop a chance to + * customize output. + */ + menu_redraw (current_menu); + } +} + #define MUTT_SEARCH_UP 1 #define MUTT_SEARCH_DOWN 2 @@ -1012,7 +1028,6 @@ int mutt_menuLoop (MUTTMENU *menu) if (SigWinch) { mutt_resize_screen (); - menu->redraw = REDRAW_FULL; SigWinch = 0; clearok(stdscr,TRUE);/*force complete redraw*/ } diff --git a/mutt_menu.h b/mutt_menu.h index 5a34b1c2..061b8dd2 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -125,6 +125,7 @@ void mutt_pop_current_menu (MUTTMENU *); void mutt_set_current_menu_redraw (int); void mutt_set_current_menu_redraw_full (); void mutt_set_menu_redraw_full (int); +void mutt_current_menu_redraw (void); int mutt_menuLoop (MUTTMENU *); /* used in both the index and pager index to make an entry. */ |