From: Jim Warner Date: Thu, 19 Jan 2012 20:33:34 +0000 (-0600) Subject: top: improve USE_X_COLHDR effect when colors toggled off X-Git-Tag: v3.3.3~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c6aa6af4190be60853acced8023470c3d1910c1;p=procps-ng 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 --- 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)