top: new #define added for focus ('F') toggle tweaking

Just to see if I could, the new #define will force the
indentation of a parent task to be reset to zero while
maintaining the proper child indentation relationship.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-07-25 00:00:00 -05:00 committed by Craig Small
parent 37a4601882
commit c23d2708d4
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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 */