summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2022-01-14 14:14:14 -0600
committerCraig Small <csmall@dropbear.xyz>2022-01-17 20:26:17 +1100
commit1387c7f84b0ce5b835a4378104c74c3ddc37e029 (patch)
treecc51510d7875b9187cdc154437a449d9b2c82855
parent99c1f0578fd6c52f7b11e753ac69fdd43dc663fd (diff)
downloadprocps-ng-newlib.tar.gz
top: add visual clue when focus toggle ('F') is activenewlib
When in forest view mode, that focus toggle ('F') is a useful tool occasionally. But, if a focused parent has enough cloned siblings to exceed screen rows, it could be hard to remember that such a toggle remains active. So, this patch will provide a subtle visual clue added to the leftmost position in the COMMAND column. Now if the focus toggle was active, regardless of total tasks affected, the users will always know when it's active. Reference(s): . -7/24/21, introduced new focus toggle commit 3e922e671daf09ae60ee211b5c0ef94996ee573d . 09/23/21, ensure focused tasks stay focused commit 69978e365043f27305e487709474947bb377084d Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--top/top.c10
-rw-r--r--top/top.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/top/top.c b/top/top.c
index f064c29..3aae009 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4685,8 +4685,16 @@ static inline const char *forest_display (const WIN_t *q, int idx) {
#endif
return buf;
}
- if (level > 100) snprintf(buf, sizeof(buf), "%400s%s", " + ", which);
+ if (level > 100) {
+ snprintf(buf, sizeof(buf), "%400s%s", " + ", which);
+ return buf;
+ }
+#ifndef FOCUS_VIZOFF
+ if (q->focus_pid) snprintf(buf, sizeof(buf), "|%*s%s", ((4 * level) - 1), "`- ", which);
else snprintf(buf, sizeof(buf), "%*s%s", (4 * level), " `- ", which);
+#else
+ snprintf(buf, sizeof(buf), "%*s%s", (4 * level), " `- ", which);
+#endif
return buf;
#undef rSv
#undef rSv_Lvl
diff --git a/top/top.h b/top/top.h
index 3e28afe..5279772 100644
--- a/top/top.h
+++ b/top/top.h
@@ -31,6 +31,7 @@
//#define EQUCOLHDRYES /* yes, equalize the column header lengths */
//#define FOCUS_HARD_Y /* 'F' will avoid topmost task distortions */
//#define FOCUS_TREE_X /* 'F' resets forest view indentation to 0 */
+//#define FOCUS_VIZOFF /* 'F' doesn't provide the visual clue '|' */
//#define GETOPTFIX_NO /* do not address getopt_long deficiencies */
//#define INSP_JUSTNOT /* do not smooth unprintable right margins */
//#define INSP_OFFDEMO /* disable demo screens, issue msg instead */