top: extend 'focus' navigation to shift+tab (back_tab)
Some of those bottom windows grow quite large, as with the firefox environment. If one is navigating the data using the tab key, it can be very inconvenient when an element should be reexamined but that focus has moved. Therefore, this commit will support the 'back_tab' key which is a standard combination of the shift+tab keys. Now a user can easily backup up to any missed element, assuming a terminal emulator honors that terminfo key. [ a gui emulator typically will honor the 'back_tab' ] [ terminfo string, whereas a linux console does not. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
c00d09edf1
commit
434e224230
20
top/top.c
20
top/top.c
@ -1124,9 +1124,9 @@ static int iokey (int action) {
|
||||
const char *str;
|
||||
int key;
|
||||
} tinfo_tab[] = {
|
||||
{ NULL, kbd_BKSP }, { NULL, kbd_INS }, { NULL, kbd_DEL },
|
||||
{ NULL, kbd_LEFT }, { NULL, kbd_DOWN }, { NULL, kbd_UP }, { NULL, kbd_RIGHT },
|
||||
{ NULL, kbd_HOME }, { NULL, kbd_PGDN }, { NULL, kbd_PGUP }, { NULL, kbd_END },
|
||||
{ NULL, kbd_BKSP }, { NULL, kbd_INS }, { NULL, kbd_DEL }, { NULL, kbd_LEFT },
|
||||
{ NULL, kbd_DOWN }, { NULL, kbd_UP }, { NULL, kbd_RIGHT }, { NULL, kbd_HOME },
|
||||
{ NULL, kbd_PGDN }, { NULL, kbd_PGUP }, { NULL, kbd_END }, { NULL, kbd_BTAB },
|
||||
// remainder are alternatives for above, just in case...
|
||||
// ( the h,j,k,l entries are the vim cursor motion keys )
|
||||
{ "\033h", kbd_LEFT }, { "\033j", kbd_DOWN }, /* meta+ h,j */
|
||||
@ -1160,6 +1160,7 @@ static int iokey (int action) {
|
||||
tinfo_tab[8].str = tOk(key_npage);
|
||||
tinfo_tab[9].str = tOk(key_ppage);
|
||||
tinfo_tab[10].str = tOk(key_end);
|
||||
tinfo_tab[11].str = tOk(back_tab);
|
||||
// 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 )
|
||||
@ -5619,6 +5620,14 @@ static void keys_global (int ch) {
|
||||
case kbd_CtrlU:
|
||||
bot_item_toggle(EU_SGN, "supplementary groups", ',');
|
||||
break;
|
||||
case kbd_BTAB:
|
||||
if (Bot_what) {
|
||||
--Bot_indx;
|
||||
num = Bot_focus_func(NULL, NULL);
|
||||
if (Bot_indx <= BOT_UNFOCUS)
|
||||
Bot_indx = num + 1;
|
||||
}
|
||||
break;
|
||||
case kbd_ENTER: // fall through
|
||||
#ifdef BOT_MENU_YES
|
||||
if (Bot_what == BOT_MENU_ON && Bot_indx != BOT_UNFOCUS)
|
||||
@ -6463,11 +6472,12 @@ static void do_key (int ch) {
|
||||
{ keys_global,
|
||||
{ '?', 'B', 'd', 'E', 'e', 'f', 'g', 'H', 'h'
|
||||
, 'I', 'k', 'r', 's', 'X', 'Y', 'Z', '0'
|
||||
, kbd_CtrlE, kbd_CtrlG, kbd_CtrlI, kbd_CtrlK, kbd_CtrlN, kbd_CtrlP, kbd_CtrlR, kbd_CtrlU
|
||||
, kbd_CtrlE, kbd_CtrlG, kbd_CtrlI, kbd_CtrlK
|
||||
, kbd_CtrlN, kbd_CtrlP, kbd_CtrlR, kbd_CtrlU
|
||||
#ifdef BOT_MENU_YES
|
||||
, kbd_CtrlH
|
||||
#endif
|
||||
, kbd_ENTER, kbd_SPACE, '\0' } },
|
||||
, kbd_ENTER, kbd_SPACE, kbd_BTAB, '\0' } },
|
||||
{ keys_summary,
|
||||
{ '!', '1', '2', '3', '4', 'C', 'l', 'm', 't', '\0' } },
|
||||
{ keys_task,
|
||||
|
Loading…
Reference in New Issue
Block a user