]> granicus.if.org Git - procps-ng/commitdiff
top: enable alternate '+' placement with collapsed pid
authorJim Warner <james.warner@comcast.net>
Mon, 1 Oct 2018 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 2 Jan 2019 21:01:25 +0000 (08:01 +1100)
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>
top/top.c
top/top.h

index dd4b9481b8a9b095feda1d7897ec9f68b95460ab..a825e683d5c844cb8f6204f8639db1bc363acde0 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -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
 #endif
    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);
+#endif
       return buf;
    }
    if (p->pad_3 > 100) snprintf(buf, sizeof(buf), "%400s%s", " +  ", which);
index d274d1094583ecb48b002d0c4f3be2e2e31c1a8b..0349679260c85471191fab70f62a9f28d01024e7 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -56,6 +56,7 @@
 //#define TERMIOS_ONLY            /* just limp along with native input only  */
 //#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 */
 //#define TREE_VCPUOFF            /* a collapsed parent excludes child's cpu */
 //#define TREE_VPROMPT            /* pid collapse/expand prompt, vs. top row */
 //#define TREE_VWINALL            /* pid collapse/expand impacts all windows */