top: remove those winflags which restricted 'x' toggle <=== port of newlib ef8d1cb6
authorJim Warner <james.warner@comcast.net>
Wed, 15 Jun 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sun, 19 Jun 2022 10:58:51 +0000 (20:58 +1000)
______________________________ original newlib message

On occasion, even as the top author, I wonder why that
'x' toggle has stopped working. Of course, it actually
was working but a locate request ('L') or other filter
('O') operation was active and thus temporarily turned
if off. Such behavior is documented in top's man page.

Well, with this patch that 'x' suppression is no more.

[ the original justification, however, remains true. ]

[ but there's really only one character which causes ]
[ any potential trouble & i'm gonna' keep it secret. ]

[ besides, if a display is corrupted, there's always ]
[ that '=' key which restores things back to normal. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
NEWS
top/top.1
top/top.c
top/top.h

diff --git a/NEWS b/NEWS
index 46f6cb23bb8e3181838916b1be7ee2c8c2f1ab69..f35755bd7e22bbe1f1a6dd71234eff57eb2fae94 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ procps-ng-NEXT
   * top: added long versions of command line options
   * top: the time related fields can now be user scaled
   * top: added a 'start time' field (STARTED)
+  * top: column highlighting allowed under 'L' or 'O'
 
 
 procps-ng-3.3.17
index f9e0c1cf9fbc3df72c271216298a4eab1594dceb..d78e9bcc50165024b8f14658170ad07d451228f8 100644 (file)
--- a/top/top.1
+++ b/top/top.1
@@ -1566,11 +1566,6 @@ The sort field might\fI not\fR be visible because:
     1) there is insufficient\fI Screen Width \fR
     2) the `f' \*(CI turned it \*F
 
-\*(NT Whenever Searching and/or Other Filtering is active in a window,
-column highlighting is temporarily disabled.
-\*(XC notes at the end of topics 5d. SEARCHING and 5e. FILTERING for an
-explanation why.
-
 .TP 7
 \ \ \ \fBy\fR\ \ :\fIRow-Highlight\fR toggle \fR
 Changes highlighting for "running" tasks.
@@ -2070,12 +2065,6 @@ could yet produce a successful `&' search.
 The above \*(CIs are\fB always\fR available in \*(FM but\fB never\fR
 available in \*(AM if the \*(CW's \*(TD has been toggled \*F.
 
-\*(NT Whenever a Search is active in a window, \*(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.
-
 .\" ......................................................................
 .SS 5e. FILTERING in a Window
 .\" ----------------------------------------------------------------------
@@ -2245,14 +2234,6 @@ achieve the failed `9999' objective discussed above.
 .fi
 .RS -3
 
-\*(NT Whenever Other Filtering is active in a window, \*(We will turn
-column highlighting \*F to prevent false matches on internal non-display
-escape sequences.
-Such highlighting will be restored when a window is no longer subject
-to filtering.
-\*(XC `x' \*(CI for additional information on sort column highlighting.
-.RE
-
 .\" ----------------------------------------------------------------------
 .SH 6. FILES
 .\" ----------------------------------------------------------------------
index ec3dd30ae725e35802efd848b63ba817864eb3e8..ecf3d88d37b4b2b4c01fb7ea1b8c67deb05b8b1a 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -3699,9 +3699,6 @@ static void osel_clear (WIN_t *q) {
    }
    q->osel_tot = 0;
    q->osel_1st = NULL;
-#ifndef USE_X_COLHDR
-   OFFw(q, NOHISEL_xxx);
-#endif
 } // end: osel_clear
 
 
@@ -4106,9 +4103,6 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) {
          if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n]))
             return p;
       }
-#ifndef USE_X_COLHDR
-      OFFw(w, NOHIFND_xxx | NOHISEL_xxx);
-#endif
    } // end: for (GROUPSMAX)
 
    // any new addition(s) last, for older rcfiles compatibility...
@@ -4552,10 +4546,6 @@ static void win_reset (WIN_t *q) {
 
          osel_clear(q);
          q->findstr[0] = '\0';
-#ifndef USE_X_COLHDR
-         // NOHISEL_xxx is redundant (already turned off by osel_clear)
-         OFFw(q, NOHIFND_xxx | NOHISEL_xxx);
-#endif
          q->rc.combine_cpus = 0;
 } // end: win_reset
 
@@ -5114,10 +5104,6 @@ static void find_string (int ch) {
       snprintf(Curwin->findstr, FNDBUFSIZ, "%s", str);
       Curwin->findlen = strlen(Curwin->findstr);
       found = 0;
-#ifndef USE_X_COLHDR
-      if (Curwin->findstr[0]) SETw(Curwin, NOHIFND_xxx);
-      else OFFw(Curwin, NOHIFND_xxx);
-#endif
    }
    if (Curwin->findstr[0]) {
       SETw(Curwin, NOPRINT_xxx);
@@ -5200,9 +5186,6 @@ static void other_filters (int ch) {
             show_msg(p);
             return;
          }
-#ifndef USE_X_COLHDR
-         SETw(w, NOHISEL_xxx);
-#endif
          break;
       case kbd_CtrlO:
          if (VIZCHKw(w)) {
@@ -5702,8 +5685,7 @@ static void keys_task (int ch) {
             TOGw(w, Show_HICOLS);
             capsmk(w);
 #else
-            if (ENUviz(w, w->rc.sortindx)
-            && !CHKw(w, NOHIFND_xxx | NOHISEL_xxx)) {
+            if (ENUviz(w, w->rc.sortindx)) {
                TOGw(w, Show_HICOLS);
                if (ENUpos(w, w->rc.sortindx) < w->begpflg) {
                   if (CHKw(w, Show_HICOLS)) w->begpflg += 2;
@@ -6397,10 +6379,10 @@ static const char *task_show (const WIN_t *q, const int idx) {
       switch (i) {
 #ifndef USE_X_COLHDR
          // these 2 aren't real procflgs, they're used in column highlighting!
-         case EU_XON:
          case EU_XOF:
+         case EU_XON:
             cp = NULL;
-            if (!CHKw(q, NOPRINT_xxx | NOHIFND_xxx | NOHISEL_xxx)) {
+            if (!CHKw(q, NOPRINT_xxx)) {
                /* treat running tasks specially - entire row may get highlighted
                   so we needn't turn it on and we MUST NOT turn it off */
                if (!('R' == p->state && CHKw(q, Show_HIROWS)))
index e596d630aeac85231afc1a47cc6ff0611c552c6d..d7a8a1c95e6ce005dc58addf3c786612b0b2ac80 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -343,10 +343,6 @@ typedef struct CPU_t {
         // these flag(s) have no command as such - they're for internal use
 #define NOPRINT_xxx  0x010000     // build task rows only (not for display)
 #define EQUWINS_xxx  0x000001     // rebalance all wins & tasks (off i,n,u/U)
-#ifndef USE_X_COLHDR
-#define NOHISEL_xxx  0x200000     // restrict Show_HICOLS for osel temporarily
-#define NOHIFND_xxx  0x100000     // restrict Show_HICOLS for find temporarily
-#endif
 
         // Default flags if there's no rcfile to provide user customizations
 #ifdef ORIG_TOPDEFS