From 7ad81c5f12a4e91ba4b009a32a961105930e94bb Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 30 Apr 2016 10:50:43 -0700 Subject: [PATCH] Fix pager layout when $status_on_top with no mini-index. (closes #3836) The pager_window->row_offset should only be adjusted when we have a mini-index. Pull common window initialization above, and adjust only when the mini-index is enabled. The pager_window rows and row_offset code could be further consolidated (since the status line is always a height of one), but I think the code reads a bit more clearly when the adjustments are explicitly stated. --- pager.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/pager.c b/pager.c index fc8eabaf..5320a1cb 100644 --- a/pager.c +++ b/pager.c @@ -1667,45 +1667,35 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) indicator = indexlen / 3; + memcpy (pager_window, MuttIndexWindow, sizeof(mutt_window_t)); + memcpy (pager_status_window, MuttStatusWindow, sizeof(mutt_window_t)); + index_status_window->rows = index_window->rows = 0; + if (IsHeader (extra) && PagerIndexLines) { memcpy (index_window, MuttIndexWindow, sizeof(mutt_window_t)); index_window->rows = indexlen > 0 ? indexlen - 1 : 0; - } - else - index_status_window->rows = index_window->rows = 0; - if (option (OPTSTATUSONTOP)) - { - if (IsHeader (extra) && PagerIndexLines) + if (option (OPTSTATUSONTOP)) { memcpy (index_status_window, MuttStatusWindow, sizeof(mutt_window_t)); memcpy (pager_status_window, MuttIndexWindow, sizeof(mutt_window_t)); pager_status_window->rows = 1; pager_status_window->row_offset += index_window->rows; + + pager_window->rows -= index_window->rows + pager_status_window->rows; + pager_window->row_offset += index_window->rows + pager_status_window->rows; } else - memcpy (pager_status_window, MuttStatusWindow, sizeof(mutt_window_t)); - - memcpy (pager_window, MuttIndexWindow, sizeof(mutt_window_t)); - pager_window->rows -= index_window->rows + pager_status_window->rows; - pager_window->row_offset += index_window->rows + pager_status_window->rows; - } - else - { - if (IsHeader (extra) && PagerIndexLines) { memcpy (index_status_window, MuttIndexWindow, sizeof(mutt_window_t)); index_status_window->rows = 1; index_status_window->row_offset += index_window->rows; - } - - memcpy (pager_status_window, MuttStatusWindow, sizeof(mutt_window_t)); - memcpy (pager_window, MuttIndexWindow, sizeof(mutt_window_t)); - pager_window->rows -= index_window->rows + index_status_window->rows; - pager_window->row_offset += index_window->rows + index_status_window->rows; + pager_window->rows -= index_window->rows + index_status_window->rows; + pager_window->row_offset += index_window->rows + index_status_window->rows; + } } if (option (OPTHELP)) -- 2.40.0