From a70421433d04a32781bc5345d4232f689d84fee3 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Wed, 5 Apr 2017 16:09:36 -0700 Subject: [PATCH] Prepare for pager redraw separation. (see #3877) Move some of the code inside SigWinch handling into the REDRAW part of the code. SigInt is handled by mutt_getch(), so remove the redundant code from inside the pager. --- pager.c | 72 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/pager.c b/pager.c index 818cc5321..ad9cfab9d 100644 --- a/pager.c +++ b/pager.c @@ -1864,11 +1864,35 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) if (pager_menu->redraw & REDRAW_SIGWINCH) { + if (!(flags & MUTT_PAGER_RETWINCH)) + { + lines = -1; + for (i = 0; i <= topline; i++) + if (!lineInfo[i].continuation) + lines++; + for (i = 0; i < maxLine; i++) + { + lineInfo[i].offset = 0; + lineInfo[i].type = -1; + lineInfo[i].continuation = 0; + lineInfo[i].chunks = 0; + lineInfo[i].search_cnt = -1; + lineInfo[i].quote = NULL; + + safe_realloc (&(lineInfo[i].syntax), + sizeof (struct syntax_t)); + if (SearchCompiled && lineInfo[i].search) + FREE (&(lineInfo[i].search)); + } + + lastLine = 0; + topline = 0; + } i = -1; j = -1; while (display_line (fp, &last_pos, &lineInfo, ++i, &lastLine, &maxLine, - has_types | SearchFlag | (flags & MUTT_PAGER_NOWRAP), &QuoteList, &q_level, &force_redraw, - &SearchRE, pager_window) == 0) + has_types | SearchFlag | (flags & MUTT_PAGER_NOWRAP), &QuoteList, &q_level, &force_redraw, + &SearchRE, pager_window) == 0) if (!lineInfo[i].continuation && ++j == lines) { topline = i; @@ -2091,24 +2115,21 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) } } - if (SigInt) - { - mutt_query_exit (); - continue; - } #if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) - else if (SigWinch) + if (SigWinch) { + SigWinch = 0; mutt_resize_screen (); - - /* Store current position. */ - lines = -1; - for (i = 0; i <= topline; i++) - if (!lineInfo[i].continuation) - lines++; + clearok(stdscr,TRUE);/*force complete redraw*/ if (flags & MUTT_PAGER_RETWINCH) { + /* Store current position. */ + lines = -1; + for (i = 0; i <= topline; i++) + if (!lineInfo[i].continuation) + lines++; + Resize = safe_malloc (sizeof (struct resize)); Resize->line = lines; @@ -2120,34 +2141,13 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) } else { - for (i = 0; i < maxLine; i++) - { - lineInfo[i].offset = 0; - lineInfo[i].type = -1; - lineInfo[i].continuation = 0; - lineInfo[i].chunks = 0; - lineInfo[i].search_cnt = -1; - lineInfo[i].quote = NULL; - - safe_realloc (&(lineInfo[i].syntax), - sizeof (struct syntax_t)); - if (SearchCompiled && lineInfo[i].search) - FREE (&(lineInfo[i].search)); - } - - lastLine = 0; - topline = 0; - pager_menu->redraw = REDRAW_FULL | REDRAW_SIGWINCH; ch = 0; } - - SigWinch = 0; - clearok(stdscr,true);/*force complete redraw*/ continue; } #endif - else if (ch == -1) + if (ch == -1) { ch = 0; mutt_timeout_hook(); -- 2.40.0