From 2f9e7e858edcb49b91dae1c093f9d011e7c0c2f1 Mon Sep 17 00:00:00 2001 From: Sebastian Stark Date: Sun, 26 May 2019 10:04:58 +0200 Subject: [PATCH] make OP_HALF_{UP,DOWN} behave symmetric. - the calculation of number of lines to scroll up/down should not depend on whether the number of rows in the pager/index/terminal is odd or even. - this patch will make the behaviour symmetric such that in both cases (even/odd number of rows) scrolling up and down by half a page (or the other way round) will get you back to the exact same line as before. --- pager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pager.c b/pager.c index 3d7048102..56e192345 100644 --- a/pager.c +++ b/pager.c @@ -2573,8 +2573,8 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P case OP_HALF_UP: if (rd.topline) { - rd.topline = up_n_lines(rd.pager_window->rows / 2, rd.line_info, - rd.topline, rd.hide_quoted); + rd.topline = up_n_lines(rd.pager_window->rows / 2 + (rd.pager_window->rows % 2), + rd.line_info, rd.topline, rd.hide_quoted); } else mutt_error(_("Top of message is shown")); -- 2.40.0