]> granicus.if.org Git - mutt/commitdiff
make OP_HALF_{UP,DOWN} behave symmetric.
authorSebastian Stark <sstark@mailbox.org>
Sun, 26 May 2019 16:52:47 +0000 (18:52 +0200)
committerKevin McCarthy <kevin@8t8.us>
Sun, 26 May 2019 17:35:25 +0000 (10:35 -0700)
  - 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

diff --git a/pager.c b/pager.c
index 50f495b702c87abb11afc835ae85749fcdf18b9a..a5c2f6ea6c5195c89f24150feb0a29ee2548b639 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2143,7 +2143,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
 
       case OP_HALF_UP:
        if (rd.topline)
-         rd.topline = upNLines (rd.pager_window->rows/2, rd.lineInfo, rd.topline, rd.hideQuoted);
+         rd.topline = upNLines (rd.pager_window->rows/2 + rd.pager_window->rows%2,
+                                 rd.lineInfo, rd.topline, rd.hideQuoted);
        else
          mutt_error _("Top of message is shown.");
        break;