top: improve vertical scroll management for 'i' toggle

When a user is taking advantage of the scroll features
it is likely a scrolled vertical position is well past
the first displayable task. That is especially true of
top's forest view ('V') mode where those early systemd
attached processes are generally not very interesting.

As such, should the idle mode toggle ('i') be employed
a distorted display is almost guaranteed because tasks
that have used some cpu, and thus should be displayed,
have already been skipped by virtue of their position.

So this patch temporarily nullifies vertical scrolling
during the period when idle tasks are not being shown.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2015-07-12 04:44:44 -05:00 committed by Craig Small
parent 5e73c83262
commit c07f6c5e6d

View File

@ -4612,6 +4612,12 @@ static void keys_task (int ch) {
VIZTOGw(w, Show_CMDLIN);
break;
case 'i':
{ static WIN_t *w_sav;
static int beg_sav;
if (w_sav != w) { beg_sav = 0; w_sav = w; }
if (CHKw(w, Show_IDLEPS)) { beg_sav = w->begtask; w->begtask = 0; }
else { w->begtask = beg_sav; beg_sav = 0; }
}
VIZTOGw(w, Show_IDLEPS);
break;
case 'J':