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
This commit is contained in:
Jim Warner 2012-01-19 14:33:34 -06:00 committed by Craig Small
parent 9573a6fe5b
commit 0c6aa6af41

View File

@ -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)