From 0c6aa6af4190be60853acced8023470c3d1910c1 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Thu, 19 Jan 2012 14:33:34 -0600 Subject: [PATCH] top: improve USE_X_COLHDR effect when colors toggled off Normally, when the chosen sort column is displayed via the 'x' command toggle the entire column is highlighted. And while this version of top substantially reduced the cost of such highlighting, a small pathlength increase remained. The USE_X_COLHDR define was an experimental alternative which eliminated all recurring runtime costs for such emphasis by highlighting the column header, not the entire column. The previous implementation required colors to be turned on (the 'z' toggle) for such highlighting to be visible. This commit extends column header emphasis to include monochrome displays as well. Reference: http://www.freelists.org/post/procps/post-nls-merge,6 --- top/top.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/top/top.c b/top/top.c index 856d8560..63fcfbd3 100644 --- a/top/top.c +++ b/top/top.c @@ -634,7 +634,12 @@ static void capsmk (WIN_t *q) { , Caps_off, tparm(set_a_foreground, q->rc.taskclr)); } else { q->capclr_sum[0] = '\0'; +#ifdef USE_X_COLHDR + snprintf(q->capclr_msg, sizeof(q->capclr_pmt), "%s%s" + , Cap_reverse, q->cap_bold); +#else STRLCPY(q->capclr_msg, Cap_reverse) +#endif STRLCPY(q->capclr_pmt, q->cap_bold) STRLCPY(q->capclr_hdr, Cap_reverse) STRLCPY(q->capclr_rownorm, Cap_norm)