diff --git a/top/top.c b/top/top.c index 179b7a32..3c3554fe 100644 --- a/top/top.c +++ b/top/top.c @@ -4478,7 +4478,8 @@ static void forest_begin (WIN_t *q) { * But, if the pid can no longer be found, he'll turn off focus! | */ static void forest_config (WIN_t *q) { // tailored 'results stack value' extractor macro - #define rSv(x) PID_VAL(eu_TREE_LVL, s_int, q->ppt[(x)]) + // (TREE_FOCUS_X can't use PID_VAL w/ assignment) + #define rSv(x) q->ppt[x]->head[eu_TREE_LVL].result.s_int int i, level; for (i = 0; i < PIDSmaxt; i++) { @@ -4491,8 +4492,15 @@ static void forest_config (WIN_t *q) { if (i == PIDSmaxt) q->focus_pid = q->begtask = 0; else { +#ifdef TREE_FOCUS_X + int j = rSv(i); + rSv(i) = 0; + while (i+1 < PIDSmaxt && rSv(i+1) > level) + rSv(++i) -= j; +#else while (i+1 < PIDSmaxt && rSv(i+1) > level) ++i; +#endif q->focus_end = i + 1; // make 'focus_end' a proper fencpost } #undef rSv diff --git a/top/top.h b/top/top.h index 4d3fe570..a15d7fd6 100644 --- a/top/top.h +++ b/top/top.h @@ -51,6 +51,7 @@ //#define TERMIOS_ONLY /* just limp along with native input only */ //#define TOG4_NOFORCE /* no force 2 abreast mode with '4' toggle */ //#define TOG4_NOTRUNC /* ensure no truncation in 2 abreast mode */ +//#define TREE_FOCUS_X /* 'F' resets forest view indentation to 0 */ //#define TREE_NORESET /* sort keys do NOT force forest view OFF */ //#define TREE_SCANALL /* rescan array w/ forest view, avoid sort */ //#define TREE_VALTMRK /* use an indented '+' with collapsed pids */