From 8626141d8f7252b1a7c5223892acefe4ac1b0ee1 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 10 Jul 2018 00:00:00 -0500 Subject: [PATCH] top: '^V' is now 'v' (collapse/expand children toggle) Using Ctrl-V for the collapse children key now appears as a mistake. First, it's too close to that Ctrl-C key which would prematurely terminate top. Second, a lower case 'v' was unused and perfectly compliments an upper case 'V' which is used to toggle 'forest view' itself. Reference(s): https://gitlab.com/procps-ng/procps/issues/99 Signed-off-by: Jim Warner --- top/top.1 | 14 +++++++------- top/top.c | 50 +++++++++++++++++++++++++------------------------- top/top.h | 1 - top/top_nls.c | 4 ++-- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/top/top.1 b/top/top.1 index daf53d08..fec223ac 100644 --- a/top/top.1 +++ b/top/top.1 @@ -603,10 +603,10 @@ divided by the total number of \*(PUs. You toggle Irix/Solaris modes with the `I' \*(CI. \*(NT When running in forest view mode (`V') with children -collapsed (`^V'), this field will also include the \*(PU time of +collapsed (`v'), this field will also include the \*(PU time of those unseen children. \*(XT 4c. TASK AREA Commands, CONTENT for more information regarding -the `V' and `^V' toggles. +the `V' and `v' toggles. .TP 4 2.\fB %MEM \*(Em Memory Usage (RES) \fR @@ -1108,7 +1108,7 @@ depending on the context in which they are issued. C, l, t, m, 1, 2, 3 4c.\fI Task-Area-Commands \fR Appearance: b, J, j, x, y, z - Content: c, f, F, o, O, S, u, U, V, ^V + Content: c, f, F, o, O, S, u, U, V, v Size: #, i, n Sorting: <, >, f, F, R 4d.\fI Color-Mapping \fR @@ -1154,7 +1154,7 @@ those \*(CIs applicable to \*(AM. \ \ \ \fB=\fR\ \ :\fIExit-Task-Limits \fR Removes restrictions on which tasks are shown. This command will reverse any `i' (idle tasks), `n' (max tasks) -and `^V' (hide children) commands that might be active. +and `v' (hide children) commands that might be active. It also provides for an exit from PID monitoring, User filtering, Other filtering and Locate processing. @@ -1588,7 +1588,7 @@ mode in the \*(CW. \*(XT 4c. TASK AREA Commands, SORTING for information on those keys. .TP 7 -\ \ \fB^V\fR\ \ :\fIHide/Show-Children\fR toggle (Ctrl key + `V') \fR +\ \ \ \fBv\fR\ \ :\fIHide/Show-Children\fR toggle \fR When in forest view mode, this key serves as a toggle to collapse or expand the children of a parent. @@ -1774,7 +1774,7 @@ as the only display element. *\ \ \fB=\fR | \fB+\fR\ \ :\fIEqualize-(reinitialize)-Window(s) \fR The `=' key forces the \*(CW's \*(TD to be visible. It also reverses any active `i' (idle tasks), `n' (max tasks), `u/U' -(user filter), `o/O' (other filter), `^V' (hide children) and 'L' (locate) +(user filter), `o/O' (other filter), `v' (hide children) and 'L' (locate) commands. Also, if the window had been scrolled, it will be reset with this command. \*(XT 5c. SCROLLING a Window for additional information regarding vertical @@ -1784,7 +1784,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), `^V' (hide children), `L' (locate) +(user filter), `o/O' (other filter), `v' (hide children), `L' (locate) and scrolling \*(CIs. .TP 7 diff --git a/top/top.c b/top/top.c index 1614e4f2..1d664467 100644 --- a/top/top.c +++ b/top/top.c @@ -5351,6 +5351,29 @@ static void keys_task (int ch) { ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt))); } break; + case 'v': + if (VIZCHKw(w)) { + if (CHKw(w, Show_FOREST)) { + int i, pid = w->ppt[w->begtask]->tid; +#ifdef TREE_VPROMPT + int got = get_int(fmtmk(N_txt(XTRA_vforest_fmt), pid)); + if (got < GET_NUM_NOT) break; + if (got > GET_NUM_NOT) pid = got; +#endif + for (i = 0; i < Hide_tot; i++) { + if (Hide_pid[i] == pid || Hide_pid[i] == -pid) { + Hide_pid[i] = -Hide_pid[i]; + break; + } + } + if (i == Hide_tot) Hide_pid[Hide_tot++] = pid; + // plenty of room, but if everything's expanded let's reset ... + for (i = 0; i < Hide_tot; i++) + if (Hide_pid[i] > 0) break; + if (i == Hide_tot) Hide_tot = 0; + } + } + break; case 'x': if (VIZCHKw(w)) { #ifdef USE_X_COLHDR @@ -5382,29 +5405,6 @@ static void keys_task (int ch) { capsmk(w); } break; - case kbd_CtrlV: - if (VIZCHKw(w)) { - if (CHKw(w, Show_FOREST)) { - int i, pid = w->ppt[w->begtask]->tid; -#ifdef TREE_VPROMPT - int got = get_int(fmtmk(N_txt(XTRA_vforest_fmt), pid)); - if (got < GET_NUM_NOT) break; - if (got > GET_NUM_NOT) pid = got; -#endif - for (i = 0; i < Hide_tot; i++) { - if (Hide_pid[i] == pid || Hide_pid[i] == -pid) { - Hide_pid[i] = -Hide_pid[i]; - break; - } - } - if (i == Hide_tot) Hide_pid[Hide_tot++] = pid; - // plenty of room, but if everything's expanded let's reset ... - for (i = 0; i < Hide_tot; i++) - if (Hide_pid[i] > 0) break; - if (i == Hide_tot) Hide_tot = 0; - } - } - break; default: // keep gcc happy break; } @@ -5611,8 +5611,8 @@ static void do_key (int ch) { { '1', '2', '3', 'C', 'l', 'm', 't', '\0' } }, { keys_task, { '#', '<', '>', 'b', 'c', 'i', 'J', 'j', 'n', 'O', 'o' - , 'R', 'S', 'U', 'u', 'V', 'x', 'y', 'z' - , kbd_CtrlO, kbd_CtrlV, '\0' } }, + , 'R', 'S', 'U', 'u', 'V', 'v', 'x', 'y', 'z' + , kbd_CtrlO, '\0' } }, { keys_window, { '+', '-', '=', '_', '&', 'A', 'a', 'G', 'L', 'w' , kbd_UP, kbd_DOWN, kbd_LEFT, kbd_RIGHT, kbd_PGUP, kbd_PGDN diff --git a/top/top.h b/top/top.h index 69ed9c23..b6e970cd 100644 --- a/top/top.h +++ b/top/top.h @@ -175,7 +175,6 @@ char *strcasestr(const char *haystack, const char *needle); #define kbd_INS 138 #define kbd_DEL 139 #define kbd_CtrlO '\017' -#define kbd_CtrlV '\026' /* Special value in Pseudo_row to force an additional procs refresh -- used at startup and for task/thread mode transitions */ diff --git a/top/top_nls.c b/top/top_nls.c index 223e6ef5..e0d5c7d5 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -553,13 +553,13 @@ static void build_uniq_nlstab (void) { " f,F,X Fields: '~1f~2'/'~1F~2' add/remove/order/sort; '~1X~2' increase fixed-width\n" "\n" " L,&,<,> . Locate: '~1L~2'/'~1&~2' find/again; Move sort column: '~1<~2'/'~1>~2' left/right\n" - " R,H,V,J . Toggle: '~1R~2' Sort; '~1H~2' Threads; '~1V~2' Forest view; '~1J~2' Num justify\n" + " R,H,J,C . Toggle: '~1R~2' Sort; '~1H~2' Threads; '~1J~2' Num justify; '~1C~2' Coordinates\n" " c,i,S,j . Toggle: '~1c~2' Cmd name/line; '~1i~2' Idle; '~1S~2' Time; '~1j~2' Str justify\n" " x~5,~1y~5 . Toggle highlights: '~1x~2' sort field; '~1y~2' running tasks\n" " z~5,~1b~5 . Toggle: '~1z~2' color/mono; '~1b~2' bold/reverse (only if 'x' or 'y')\n" " u,U,o,O . Filter by: '~1u~2'/'~1U~2' effective/any user; '~1o~2'/'~1O~2' other criteria\n" " n,#,^O . Set: '~1n~2'/'~1#~2' max tasks displayed; Show: ~1Ctrl~2+'~1O~2' other filter(s)\n" - " C,^V . Toggle: '~1C~2' coordinates; ~1Ctrl~2+'~1V~2' hide/show forest view children\n" + " V,v . Toggle: '~1V~2' forest view; '~1v~2' hide/show forest view children\n" "\n" "%s" " W,Y Write configuration file '~1W~2'; Inspect other output '~1Y~2'\n"