From 657ac2e0c7993131c1b52e7ed5bd368da7ef4fea Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Fri, 9 Oct 2015 00:00:00 -0500 Subject: [PATCH] top: extend '=' key to include active 'locate' request It is documented behavior that when certain other keys are active, sorts column highlighting will temporarily be disabled. Among those keys is the 'L' (locate/find) provision. The equals ('=') key can be used to restore column highlighting by resetting other keys, except 1. When a locate/find is active, the '=' key will have no effect on 'x' column highlighting, which still remains disabled. Further, when 'L' is active an 'x' keystroke is processed changing the state of column highlighting but without any visual clue (since it's yet disabled). So this commit just extends the '=' key to embrace 'L' processing resets, just like other highlight disabling keys while avoiding 'x' state changes if approproiate. Signed-off-by: Jim Warner --- top/top.1 | 13 +++++++------ top/top.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/top/top.1 b/top/top.1 index a3a09e2e..9d5c0530 100644 --- a/top/top.1 +++ b/top/top.1 @@ -1016,10 +1016,11 @@ those \*(CIs applicable to \*(AM. Removes restrictions on which tasks are shown. This command will reverse any `i' (idle tasks) and `n' (max tasks) commands that might be active. -It also provides for an exit from PID monitoring, User filtering -and Other filtering. +It also provides for an exit from PID monitoring, User filtering, +Other filtering and Locate processing. See the `\-p' \*(CO for a discussion of PID monitoring, the `U' or `u' -\*(CIs for User filtering and the `O' or `o' \*(CIs for Other filtering. +\*(CIs for User filtering the `O' or `o' \*(CIs for Other filtering +and `L' or `&' \*(CIs for Locate processing. Additionally, any window that has been scrolled will be reset with this command. @@ -1623,8 +1624,8 @@ as the only display element. .TP 7 *\ \ \fB=\fR | \fB+\fR\ \ :\fIEqualize-(reinitialize)-Window(s) \fR The `=' key forces the \*(CW's \*(TD to be visible. -It also reverses any `i' (idle tasks), `n' (max tasks), `u/U' (user filter) -and `o/O' (other filter) commands that might be active. +It also reverses any `i' (idle tasks), `n' (max tasks), `u/U' (user filter), +\`o/O' (other filter) and 'L' (locate) commands that might be active. Also, if the window had been scrolled, it will be reset with this command. \*(XT 5c. SCROLLING a Window for additional information regarding vertical and horizontal scrolling. @@ -1633,7 +1634,7 @@ The `+' key does the same for all windows. The four \*(TDs will reappear, evenly balanced. They will also have retained any customizations you had previously applied, except for the `i' (idle tasks), `n' (max tasks), `u/U' -(user filter), `o/O' (other filter) and scrolling \*(CIs. +(user filter), `o/O' (other filter), `L' (locate) and scrolling \*(CIs. .TP 7 *\ \ \fBA\fR\ \ :\fIAlternate-Display-Mode\fR toggle \fR diff --git a/top/top.c b/top/top.c index 253b7961..99d39d6e 100644 --- a/top/top.c +++ b/top/top.c @@ -3462,8 +3462,13 @@ static void win_reset (WIN_t *q) { #else q->rc.maxtasks = q->usrseltyp = q->begpflg = q->begtask = 0; #endif - osel_clear(q); Monpidsidx = 0; + 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 } // end: win_reset @@ -4292,7 +4297,8 @@ static void keys_task (int ch) { TOGw(w, Show_HICOLS); capsmk(w); #else - if (ENUviz(w, w->rc.sortindx)) { + if (ENUviz(w, w->rc.sortindx) + && !CHKw(w, NOHIFND_xxx | NOHISEL_xxx)) { TOGw(w, Show_HICOLS); if (ENUpos(w, w->rc.sortindx) < w->begpflg) { if (CHKw(w, Show_HICOLS)) w->begpflg += 2;