summaryrefslogtreecommitdiff
path: root/top
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2022-06-15 00:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2022-06-19 20:58:51 +1000
commit05fa17da19bc1bc5e1ebc4c88870b440d7745ff9 (patch)
treed7ccc887a1a4ca83d2b08308b1c81fd6733f75f8 /top
parentfca066865bee3956be971a833fafd846e9cda4d1 (diff)
downloadprocps-ng-05fa17da19bc1bc5e1ebc4c88870b440d7745ff9.tar.gz
top: apply a special emphasis with some focus elements <=== port of newlib 1dd27ba3
______________________________ original newlib message Since top now uses string vectors for two items in the new focus window (cmdline & environ), there is no real use for that 'separator' specified at toggle time. So, this commit will find a new use for what is the space. Henceforth, when a user is navigating using the tab or backtab keys, should a strv element with focus contain embedded space(s), it will be emphasized & highlighted using the current window's message color (capclr_msg). Signed-off-by: Jim Warner <james.warner@comcast.net>
Diffstat (limited to 'top')
-rw-r--r--top/top.c15
-rw-r--r--top/top.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/top/top.c b/top/top.c
index 7ee4bc2..a4c6e69 100644
--- a/top/top.c
+++ b/top/top.c
@@ -5105,11 +5105,16 @@ static void forest_excluded (WIN_t *q) {
* This guy actually draws the parsed strings |
* including adding a highlight if necessary. | */
static void bot_do (const char *str, int focus) {
+ char *cap = Cap_norm;
+
while (*str == ' ') putchar(*(str++));
- putp(fmtmk("%s%s%s"
- , focus ? Cap_reverse : Cap_norm
- , str
- , Cap_norm));
+ if (focus)
+#ifdef BOT_STRV_OFF
+ cap = Cap_reverse;
+#else
+ cap = strchr(str, Bot_sep) ? Curwin->capclr_msg : Cap_reverse;
+#endif
+ putp(fmtmk("%s%s%s", cap, str, Cap_norm));
} // end: bot_do
@@ -5770,9 +5775,11 @@ static void keys_global (int ch) {
}
break;
case kbd_CtrlK:
+ // with string vectors, the 'separator' may serve a different purpose
bot_item_toggle(PROC_FILLCOM|PROC_FILLARG, "command line", BOT_SEP_SPC);
break;
case kbd_CtrlN:
+ // with string vectors, the 'separator' may serve a different purpose
bot_item_toggle(PROC_FILLENV, "environment", BOT_SEP_SPC);
break;
case kbd_CtrlP:
diff --git a/top/top.h b/top/top.h
index e38fcf2..b516ef7 100644
--- a/top/top.h
+++ b/top/top.h
@@ -31,6 +31,7 @@
//#define ATEOJ_RPTSTD /* report on some miscellany at end-of-job */
//#define BOT_DEAD_ZAP /* zap Ctrl bottom window when target dies */
//#define BOT_MENU_YES /* enable bottom window for menu prototype */
+//#define BOT_STRV_OFF /* don't emphasize strv w/ focus if spaces */
//#define CASEUP_HEXES /* show all those hex values in upper case */
//#define CASEUP_SUFIX /* show time/mem/cnts suffix in upper case */
//#define CPU_ZEROTICS /* tolerate few tics when cpu off vs. idle */