top: prevent display corruption in Locate highlighting

There existed a small chance that the display could be
corrupted when a search string was found within a row.
For that to happen, conditions like these were needed:

. a very short Locate string was active in some window
. the string matched part of a terminfo <esc> sequence
. that sequence was used in highlighting running tasks
. the 'x' toggle was active (sort column highlighting)

One solution to this potential problem was to manually
turn off sort column highlighting before using Locate.
But rather than rely on a user remedy, we'll automate.

Since other top provisions were already being enforced
when Locate was in use (off 'i' and/or 'u'/'U'), we'll
now also force column highlighting off when the search
string in a given window is not empty. However, unlike
idle tasks and user filtering, when that search string
*is* emptied, we restore highlighting for that window.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2013-01-04 00:00:00 -06:00
committed by Craig Small
parent 1da293bf59
commit d9f7c76114
3 changed files with 16 additions and 2 deletions

View File

@@ -90,7 +90,7 @@
.
.\" Document /////////////////////////////////////////////////////////////
.\" ----------------------------------------------------------------------
.TH TOP 1 "November 2012" "procps-ng" "User Commands"
.TH TOP 1 "January 2013" "procps-ng" "User Commands"
.\" ----------------------------------------------------------------------
.\" ----------------------------------------------------------------------
@@ -1662,6 +1662,10 @@ available in \*(AM if the \*(CW's \*(TD has been toggled \*F.
filtering \*F to ensure that every task is encountered.
\*(XC 'i' and 'u/U' \*(CIs for additional information on how displayed tasks
might be filtered.
Additionally, \*(We will turn column highlighting \*F to prevent false
matches on internal non-display escape sequences.
Such highlighting will be restored when a window's search string is empty.
\*(XC 'x' \*(CI for additional information on sort column highlighting.
.\" ----------------------------------------------------------------------
.SH 6. FILES