From: Jim Warner Date: Mon, 1 Feb 2016 06:00:00 +0000 (-0600) Subject: top: tweaks to vertical scroll management & 'i' toggle X-Git-Tag: v3.3.12~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=717d73f1dd3cab7dd85c89924596a52d39c277a9;p=procps-ng top: tweaks to vertical scroll management & 'i' toggle The commit referenced below claims to disable vertical scrolling when idle tasks weren't being shown. However it really addresses only a point in time when that 'i' toggle is keyed. Left untouched were the up/down keys. So this commit will simply finish the job of disabling vertical scrolling whenever tasks which have used some CPU are the only ones which are currently being shown. Reference(s): commit c07f6c5e6d6170ef3f2373b4d86988184c3235bf Signed-off-by: Jim Warner --- diff --git a/top/top.c b/top/top.c index 64b6ef80..e355747f 100644 --- a/top/top.c +++ b/top/top.c @@ -4730,10 +4730,10 @@ static void keys_window (int ch) { } break; case kbd_UP: - if (VIZCHKw(w)) if (0 < w->begtask) w->begtask -= 1; + if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS) && 0 < w->begtask) w->begtask -= 1; break; case kbd_DOWN: - if (VIZCHKw(w)) if (w->begtask < Frame_maxtask - 1) w->begtask += 1; + if (VIZCHKw(w)) if (CHKw(w, Show_IDLEPS) && (w->begtask < Frame_maxtask - 1)) w->begtask += 1; break; #ifdef USE_X_COLHDR // ------------------------------------ case kbd_LEFT: