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;
|
const char *str;
|
||||||
int key;
|
int key;
|
||||||
} tinfo_tab[] = {
|
} tinfo_tab[] = {
|
||||||
{ NULL, kbd_BKSP }, { NULL, kbd_INS }, { NULL, kbd_DEL },
|
{ NULL, kbd_BKSP }, { NULL, kbd_INS }, { NULL, kbd_DEL }, { NULL, kbd_LEFT },
|
||||||
{ NULL, kbd_LEFT }, { NULL, kbd_DOWN }, { NULL, kbd_UP }, { NULL, kbd_RIGHT },
|
{ NULL, kbd_DOWN }, { NULL, kbd_UP }, { NULL, kbd_RIGHT }, { NULL, kbd_HOME },
|
||||||
{ NULL, kbd_HOME }, { NULL, kbd_PGDN }, { NULL, kbd_PGUP }, { NULL, kbd_END },
|
{ NULL, kbd_PGDN }, { NULL, kbd_PGUP }, { NULL, kbd_END }, { NULL, kbd_BTAB },
|
||||||
// remainder are alternatives for above, just in case...
|
// remainder are alternatives for above, just in case...
|
||||||
// ( the h,j,k,l entries are the vim cursor motion keys )
|
// ( the h,j,k,l entries are the vim cursor motion keys )
|
||||||
{ "\033h", kbd_LEFT }, { "\033j", kbd_DOWN }, /* meta+ h,j */
|
{ "\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[8].str = tOk(key_npage);
|
||||||
tinfo_tab[9].str = tOk(key_ppage);
|
tinfo_tab[9].str = tOk(key_ppage);
|
||||||
tinfo_tab[10].str = tOk(key_end);
|
tinfo_tab[10].str = tOk(key_end);
|
||||||
|
tinfo_tab[11].str = tOk(back_tab);
|
||||||
// next is critical so returned results match bound terminfo keys
|
// next is critical so returned results match bound terminfo keys
|
||||||
putp(tOk(keypad_xmit));
|
putp(tOk(keypad_xmit));
|
||||||
// ( converse keypad_local issued at pause/pgm end, just in case )
|
// ( converse keypad_local issued at pause/pgm end, just in case )
|
||||||
@ -5619,6 +5620,14 @@ static void keys_global (int ch) {
|
|||||||
case kbd_CtrlU:
|
case kbd_CtrlU:
|
||||||
bot_item_toggle(EU_SGN, "supplementary groups", ',');
|
bot_item_toggle(EU_SGN, "supplementary groups", ',');
|
||||||
break;
|
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
|
case kbd_ENTER: // fall through
|
||||||
#ifdef BOT_MENU_YES
|
#ifdef BOT_MENU_YES
|
||||||
if (Bot_what == BOT_MENU_ON && Bot_indx != BOT_UNFOCUS)
|
if (Bot_what == BOT_MENU_ON && Bot_indx != BOT_UNFOCUS)
|
||||||
@ -6463,11 +6472,12 @@ static void do_key (int ch) {
|
|||||||
{ keys_global,
|
{ keys_global,
|
||||||
{ '?', 'B', 'd', 'E', 'e', 'f', 'g', 'H', 'h'
|
{ '?', 'B', 'd', 'E', 'e', 'f', 'g', 'H', 'h'
|
||||||
, 'I', 'k', 'r', 's', 'X', 'Y', 'Z', '0'
|
, '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
|
#ifdef BOT_MENU_YES
|
||||||
, kbd_CtrlH
|
, kbd_CtrlH
|
||||||
#endif
|
#endif
|
||||||
, kbd_ENTER, kbd_SPACE, '\0' } },
|
, kbd_ENTER, kbd_SPACE, kbd_BTAB, '\0' } },
|
||||||
{ keys_summary,
|
{ keys_summary,
|
||||||
{ '!', '1', '2', '3', '4', 'C', 'l', 'm', 't', '\0' } },
|
{ '!', '1', '2', '3', '4', 'C', 'l', 'm', 't', '\0' } },
|
||||||
{ keys_task,
|
{ keys_task,
|
||||||
|
@ -175,6 +175,7 @@ char *strcasestr(const char *haystack, const char *needle);
|
|||||||
#define kbd_BKSP 137
|
#define kbd_BKSP 137
|
||||||
#define kbd_INS 138
|
#define kbd_INS 138
|
||||||
#define kbd_DEL 139
|
#define kbd_DEL 139
|
||||||
|
#define kbd_BTAB 140
|
||||||
#define kbd_CtrlE '\005'
|
#define kbd_CtrlE '\005'
|
||||||
#define kbd_CtrlG '\007'
|
#define kbd_CtrlG '\007'
|
||||||
#ifdef BOT_MENU_YES
|
#ifdef BOT_MENU_YES
|
||||||
|
Loading…
Reference in New Issue
Block a user