mirror of
https://github.com/tmux/tmux.git
synced 2024-11-18 02:18:53 +00:00
Change g and G to go to top and bottom of menu, GitHub issue 3286.
This commit is contained in:
parent
c6e7568471
commit
de5cd54124
63
menu.c
63
menu.c
@ -323,27 +323,64 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
|
|||||||
} while ((name == NULL || *name == '-') && md->choice != old);
|
} while ((name == NULL || *name == '-') && md->choice != old);
|
||||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||||
return (0);
|
return (0);
|
||||||
case 'g':
|
|
||||||
case KEYC_PPAGE:
|
case KEYC_PPAGE:
|
||||||
case '\002': /* C-b */
|
case '\002': /* C-b */
|
||||||
if (md->choice > 5)
|
if (md->choice < 6)
|
||||||
md->choice -= 5;
|
|
||||||
else
|
|
||||||
md->choice = 0;
|
md->choice = 0;
|
||||||
while (md->choice != count && (name == NULL || *name == '-'))
|
else {
|
||||||
|
i = 5;
|
||||||
|
while (i > 0) {
|
||||||
|
md->choice--;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
if (md->choice != 0 &&
|
||||||
|
(name != NULL && *name != '-'))
|
||||||
|
i--;
|
||||||
|
else if (md->choice == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||||
|
break;
|
||||||
|
case KEYC_NPAGE:
|
||||||
|
if (md->choice > count - 6) {
|
||||||
|
md->choice = count - 1;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
} else {
|
||||||
|
i = 5;
|
||||||
|
while (i > 0) {
|
||||||
|
md->choice++;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
if (md->choice != count - 1 &&
|
||||||
|
(name != NULL && *name != '-'))
|
||||||
|
i++;
|
||||||
|
else if (md->choice == count - 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (name == NULL || *name == '-') {
|
||||||
|
md->choice--;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
}
|
||||||
|
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
case KEYC_HOME:
|
||||||
|
md->choice = 0;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
while (name == NULL || *name == '-') {
|
||||||
md->choice++;
|
md->choice++;
|
||||||
if (md->choice == count)
|
name = menu->items[md->choice].name;
|
||||||
md->choice = -1;
|
}
|
||||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
case KEYC_NPAGE:
|
case KEYC_END:
|
||||||
if (md->choice > count - 6)
|
md->choice = count - 1;
|
||||||
md->choice = count - 1;
|
name = menu->items[md->choice].name;
|
||||||
else
|
while (name == NULL || *name == '-') {
|
||||||
md->choice += 5;
|
|
||||||
while (md->choice != -1 && (name == NULL || *name == '-'))
|
|
||||||
md->choice--;
|
md->choice--;
|
||||||
|
name = menu->items[md->choice].name;
|
||||||
|
}
|
||||||
c->flags |= CLIENT_REDRAWOVERLAY;
|
c->flags |= CLIENT_REDRAWOVERLAY;
|
||||||
break;
|
break;
|
||||||
case '\006': /* C-f */
|
case '\006': /* C-f */
|
||||||
|
Loading…
Reference in New Issue
Block a user