top: treat additional keys like the find_string() keys
With the introduction of the 'locate string' provisions, the precedent for calling tertiary helper functions from secondary do_key helper functions was established. This commit simply migrates some additional keys out of the do_key function itself and into the more generalized key table.
This commit is contained in:
parent
0c6aa6af41
commit
d7c986cd30
19
top/top.c
19
top/top.c
@ -2772,6 +2772,10 @@ static void keys_global (int ch) {
|
|||||||
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
case '?':
|
||||||
|
case 'h':
|
||||||
|
help_view();
|
||||||
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
TOGw(w, View_NOBOLD);
|
TOGw(w, View_NOBOLD);
|
||||||
capsmk(w);
|
capsmk(w);
|
||||||
@ -2840,6 +2844,10 @@ static void keys_global (int ch) {
|
|||||||
case 'Z':
|
case 'Z':
|
||||||
wins_colors();
|
wins_colors();
|
||||||
break;
|
break;
|
||||||
|
case kbd_ENTER: // these two have the effect of waking us
|
||||||
|
case kbd_SPACE: // from 'select()', updating hotplugged
|
||||||
|
sysinfo_refresh(1); // resources and refreshing the display
|
||||||
|
break;
|
||||||
default: // keep gcc happy
|
default: // keep gcc happy
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3230,7 +3238,8 @@ static void do_key (int ch) {
|
|||||||
char keys[SMLBUFSIZ];
|
char keys[SMLBUFSIZ];
|
||||||
} key_tab[] = {
|
} key_tab[] = {
|
||||||
{ keys_global,
|
{ keys_global,
|
||||||
{ 'B', 'd', 'F', 'f', 'g', 'H', 'I', 'k', 'r', 's', 'Z' } },
|
{ '?', 'B', 'd', 'F', 'f', 'g', 'H', 'h', 'I', 'k', 'r', 's', 'Z'
|
||||||
|
, kbd_ENTER, kbd_SPACE } },
|
||||||
{ keys_summary,
|
{ keys_summary,
|
||||||
{ '1', 'C', 'l', 'm', 't' } },
|
{ '1', 'C', 'l', 'm', 't' } },
|
||||||
{ keys_task,
|
{ keys_task,
|
||||||
@ -3254,14 +3263,6 @@ static void do_key (int ch) {
|
|||||||
case 'W': // no need for rebuilds
|
case 'W': // no need for rebuilds
|
||||||
file_writerc();
|
file_writerc();
|
||||||
return;
|
return;
|
||||||
case '?': // might need rebuilds,
|
|
||||||
case 'h': // if curwin is changed
|
|
||||||
help_view();
|
|
||||||
break;
|
|
||||||
case kbd_ENTER: // these two will have the effect of waking us
|
|
||||||
case kbd_SPACE: // from 'select()', updating hotplugged resources
|
|
||||||
sysinfo_refresh(1); // and then refreshing the display
|
|
||||||
break;
|
|
||||||
default: // and now, the real work...
|
default: // and now, the real work...
|
||||||
for (i = 0; i < MAXTBL(key_tab); ++i)
|
for (i = 0; i < MAXTBL(key_tab); ++i)
|
||||||
if (strchr(key_tab[i].keys, ch)) {
|
if (strchr(key_tab[i].keys, ch)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user