]> granicus.if.org Git - procps-ng/commitdiff
top: treat all of those vertical scroll keys uniformly
authorJim Warner <james.warner@comcast.net>
Wed, 6 Jun 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 13 Jun 2018 12:11:28 +0000 (22:11 +1000)
When not displaying all tasks (the 'i' toggle is off),
the concept of vertical scrolling has no real meaning.

However, only 2 keys (up/down) impacting that vertical
position were currently being disabled with this mode.

This patch will extend such treatment to the following
additional vertical impact keys: pgup,pgdn,home & end.

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

index 76ae0deed61e085d260ec002ea7c6d168e578cb9..df83e8d15ab21cee29deb91eee9e3e0c56997119 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5215,33 +5215,39 @@ static void keys_window (int ch) {
          break;
 #endif // USE_X_COLHDR ------------------------------------
       case kbd_PGUP:
-         if (VIZCHKw(w)) if (0 < w->begtask) {
+         if (VIZCHKw(w)) {
+            if (CHKw(w, Show_IDLEPS) && 0 < w->begtask) {
                w->begtask -= (w->winlines - 1);
                if (0 > w->begtask) w->begtask = 0;
             }
+         }
          break;
       case kbd_PGDN:
-         if (VIZCHKw(w)) if (w->begtask < Frame_maxtask - 1) {
+         if (VIZCHKw(w)) {
+            if (CHKw(w, Show_IDLEPS) && w->begtask < Frame_maxtask - 1) {
                w->begtask += (w->winlines - 1);
                if (w->begtask > Frame_maxtask - 1) w->begtask = Frame_maxtask - 1;
                if (0 > w->begtask) w->begtask = 0;
-             }
+            }
+         }
          break;
       case kbd_HOME:
 #ifndef SCROLLVAR_NO
-         if (VIZCHKw(w)) w->begtask = w->begpflg = w->varcolbeg = 0;
+         if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS)) w->begtask = w->begpflg = w->varcolbeg = 0;
 #else
-         if (VIZCHKw(w)) w->begtask = w->begpflg = 0;
+         if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS)) w->begtask = w->begpflg = 0;
 #endif
          break;
       case kbd_END:
          if (VIZCHKw(w)) {
-            w->begtask = (Frame_maxtask - w->winlines) + 1;
-            if (0 > w->begtask) w->begtask = 0;
-            w->begpflg = w->endpflg;
+            if (CHKw(w, Show_IDLEPS)) {
+               w->begtask = (Frame_maxtask - w->winlines) + 1;
+               if (0 > w->begtask) w->begtask = 0;
+               w->begpflg = w->endpflg;
 #ifndef SCROLLVAR_NO
-            w->varcolbeg = 0;
+               w->varcolbeg = 0;
 #endif
+            }
          }
          break;
       default:                    // keep gcc happy