top: enable alternate '+' placement with collapsed pid

Currently, except for tasks that have no parents, when
a process' children are collapsed the '+' indicator is
shown in the first position within that COMMAND field.

This commit simply provides for indenting the '+' char
so it displays next to that program name/command line.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2018-10-01 00:00:00 -05:00 committed by Craig Small
parent 664d2517da
commit d8a0ab8bc1
2 changed files with 5 additions and 0 deletions

View File

@ -4840,7 +4840,11 @@ static inline const char *forest_display (const WIN_t *q, const proc_t *p) {
if (q == Curwin) // note: the following is NOT indented if (q == Curwin) // note: the following is NOT indented
#endif #endif
if (p->pad_2 == 'x') { if (p->pad_2 == 'x') {
#ifdef TREE_VALTMRK
snprintf(buf, sizeof(buf), "%*s%s", (4 * p->pad_3), "`+ ", which);
#else
snprintf(buf, sizeof(buf), "+%*s%s", ((4 * p->pad_3) - 1), "`- ", which); snprintf(buf, sizeof(buf), "+%*s%s", ((4 * p->pad_3) - 1), "`- ", which);
#endif
return buf; return buf;
} }
if (p->pad_3 > 100) snprintf(buf, sizeof(buf), "%400s%s", " + ", which); if (p->pad_3 > 100) snprintf(buf, sizeof(buf), "%400s%s", " + ", which);

View File

@ -56,6 +56,7 @@
//#define TERMIOS_ONLY /* just limp along with native input only */ //#define TERMIOS_ONLY /* just limp along with native input only */
//#define TREE_NORESET /* sort keys do NOT force forest view OFF */ //#define TREE_NORESET /* sort keys do NOT force forest view OFF */
//#define TREE_SCANALL /* rescan array w/ forest view, avoid sort */ //#define TREE_SCANALL /* rescan array w/ forest view, avoid sort */
//#define TREE_VALTMRK /* use an indented '+' with collapsed pids */
//#define TREE_VCPUOFF /* a collapsed parent excludes child's cpu */ //#define TREE_VCPUOFF /* a collapsed parent excludes child's cpu */
//#define TREE_VPROMPT /* pid collapse/expand prompt, vs. top row */ //#define TREE_VPROMPT /* pid collapse/expand prompt, vs. top row */
//#define TREE_VWINALL /* pid collapse/expand impacts all windows */ //#define TREE_VWINALL /* pid collapse/expand impacts all windows */