]> granicus.if.org Git - procps-ng/commitdiff
top: improve USE_X_COLHDR effect when colors toggled off
authorJim Warner <james.warner@comcast.net>
Thu, 19 Jan 2012 20:33:34 +0000 (14:33 -0600)
committerCraig Small <csmall@enc.com.au>
Wed, 8 Feb 2012 09:57:38 +0000 (20:57 +1100)
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

index 856d856068bd942aaa65a44773f33e0fe25df483..63fcfbd3a37974b5c5c24c1cd478cc3e2647f680 100644 (file)
--- 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)