diff --git a/top/top.1 b/top/top.1 index ba52f472..9e801e8b 100644 --- a/top/top.1 +++ b/top/top.1 @@ -62,7 +62,7 @@ . .\" Document ///////////////////////////////////////////////////////////// .\" ---------------------------------------------------------------------- -.TH TOP 1 "July 2018" "procps-ng" "User Commands" +.TH TOP 1 "June 2019" "procps-ng" "User Commands" .\" ---------------------------------------------------------------------- .\" ---------------------------------------------------------------------- @@ -198,15 +198,15 @@ motion keys like the standard \*(KAs plus the Home, End, PgUp and PgDn keys. If your terminal or emulator does not provide those keys, the following combinations are accepted as alternatives: .nf - \fI key equivalent-key-combinations \fR - Up alt +\fB \\\fR or alt +\fB k \fR - Down alt +\fB /\fR or alt +\fB j \fR - Left alt +\fB <\fR or alt +\fB h \fR - Right alt +\fB >\fR or alt +\fB l \fR(lower case L) - PgUp alt +\fB Up\fR or alt + ctrl +\fB k \fR - PgDn alt +\fB Down\fR or alt + ctrl +\fB j \fR - Home alt +\fB Left\fR or alt + ctrl +\fB h \fR - End alt +\fB Right\fR or alt + ctrl +\fB l \fR + \fI key equivalent-keys \fR + Left alt +\fB h \fR + Down alt +\fB j \fR + Up alt +\fB k \fR + Right alt +\fB l \fR + Home alt + ctrl +\fB h \fR + PgDn alt + ctrl +\fB j \fR + PgUp alt + ctrl +\fB k \fR + End alt + ctrl +\fB l \fR .fi The \fBUp\fR and \fBDown\fR \*(KAs have special significance when prompted diff --git a/top/top.c b/top/top.c index 505e44e2..27a1f8e9 100644 --- a/top/top.c +++ b/top/top.c @@ -969,8 +969,6 @@ static int ioch (int ech, char *buf, unsigned cnt) { * note: we support more keys than we currently need, in case * we attract new consumers in the future */ static int iokey (int action) { - static char buf12[CAPBUFSIZ], buf13[CAPBUFSIZ] - , buf14[CAPBUFSIZ], buf15[CAPBUFSIZ]; static struct { const char *str; int key; @@ -979,17 +977,16 @@ static int iokey (int action) { { NULL, kbd_LEFT }, { NULL, kbd_RIGHT }, { NULL, kbd_PGUP }, { NULL, kbd_PGDN }, { NULL, kbd_HOME }, { NULL, kbd_END }, { NULL, kbd_BKSP }, { NULL, kbd_INS }, { NULL, kbd_DEL }, - // next 4 destined to be meta + arrow keys... - { buf12, kbd_PGUP }, { buf13, kbd_PGDN }, - { buf14, kbd_HOME }, { buf15, kbd_END }, // remainder are alternatives for above, just in case... // ( the k,j,l,h entries are the vim cursor motion keys ) - { "\033\\", kbd_UP }, { "\033/", kbd_DOWN }, /* meta+ \,/ */ - { "\033<", kbd_LEFT }, { "\033>", kbd_RIGHT }, /* meta+ <,> */ { "\033k", kbd_UP }, { "\033j", kbd_DOWN }, /* meta+ k,j */ { "\033h", kbd_LEFT }, { "\033l", kbd_RIGHT }, /* meta+ h,l */ { "\033\013", kbd_PGUP }, { "\033\012", kbd_PGDN }, /* ctrl+meta+ k,j */ - { "\033\010", kbd_HOME }, { "\033\014", kbd_END } /* ctrl+meta+ h,l */ + { "\033\010", kbd_HOME }, { "\033\014", kbd_END }, /* ctrl+meta+ h,l */ + { "\xC3\xAB", kbd_UP }, { "\xC3\xAA", kbd_DOWN }, /* meta+ k,j (some xterms) */ + { "\xC3\xA8", kbd_LEFT }, { "\xC3\xAC", kbd_RIGHT }, /* meta+ h,l (some xterms) */ + { "\xC2\x8B", kbd_PGUP }, { "\xC2\x8A", kbd_PGDN }, /* ctrl+meta+ k,j (some xterms) */ + { "\xC2\x88", kbd_HOME }, { "\xC2\x8C", kbd_END } /* ctrl+meta+ h,l (some xterms) */ }; #ifdef TERMIOS_ONLY char buf[SMLBUFSIZ], *pb; @@ -1013,10 +1010,6 @@ static int iokey (int action) { tinfo_tab[9].str = tOk(key_backspace); tinfo_tab[10].str = tOk(key_ic); tinfo_tab[11].str = tOk(key_dc); - STRLCPY(buf12, fmtmk("\033%s", tOk(key_up))); - STRLCPY(buf13, fmtmk("\033%s", tOk(key_down))); - STRLCPY(buf14, fmtmk("\033%s", tOk(key_left))); - STRLCPY(buf15, fmtmk("\033%s", tOk(key_right))); // next is critical so returned results match bound terminfo keys putp(tOk(keypad_xmit)); // ( converse keypad_local issued at pause/pgm end, just in case ) @@ -1055,7 +1048,7 @@ static int iokey (int action) { return tinfo_tab[i].key; // no match, so we'll return single non-escaped keystrokes only - if (buf[0] == '\033' && buf[1]) return 0; + if (buf[0] == '\033' && buf[1]) return -1; return buf[0]; } // end: iokey