]> granicus.if.org Git - procps-ng/commitdiff
top: standardize PgUp/PgDn management within task area
authorJim Warner <james.warner@comcast.net>
Sat, 29 Jun 2019 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 4 Jul 2019 10:42:27 +0000 (20:42 +1000)
This commit standardizes the behavior of the PgUp/PgDn
keys when on the main top display. With PgDn, the last
process will become the first process. With PgUp, that
first task will now appear as the last task displayed.

[ this also eliminates some quirks that were evident ]
[ when paging at or near the end of the process list ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index a2678a3720be9d4ad070d6e45c75e2a0ae50f117..088a59cfc799886051461c7342d0cf389b0c7e4a 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5559,14 +5559,14 @@ static void keys_window (int ch) {
       case kbd_PGUP:
          if (VIZCHKw(w)) {
             if (CHKw(w, Show_IDLEPS) && 0 < w->begtask) {
-               w->begnext = -(w->winlines - 1);
+               w->begnext = -(w->winlines - (Rc.mode_altscr ? 1 : 2));
             }
          }
          break;
       case kbd_PGDN:
          if (VIZCHKw(w)) {
             if (CHKw(w, Show_IDLEPS) && w->begtask < Frame_maxtask - 1) {
-               w->begnext = +(w->winlines - 1);
+               w->begnext = +(w->winlines - (Rc.mode_altscr ? 1 : 2));
             }
          }
          break;