mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 19:39:04 +00:00
Add start-of-list, end-of-list, top-line and bottom-line in choice mode, from
madmaverick9 at roxxmail dot eu, similar diff a few days earlier from Marcel Partap.
This commit is contained in:
parent
582c2671dd
commit
9134e4de1e
15
mode-key.c
15
mode-key.c
@ -76,14 +76,18 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
|
||||
/* Choice keys command strings. */
|
||||
const struct mode_key_cmdstr mode_key_cmdstr_choice[] = {
|
||||
{ MODEKEYCHOICE_BACKSPACE, "backspace" },
|
||||
{ MODEKEYCHOICE_BOTTOMLINE, "bottom-line"},
|
||||
{ MODEKEYCHOICE_CANCEL, "cancel" },
|
||||
{ MODEKEYCHOICE_CHOOSE, "choose" },
|
||||
{ MODEKEYCHOICE_DOWN, "down" },
|
||||
{ MODEKEYCHOICE_ENDOFLIST, "end-of-list"},
|
||||
{ MODEKEYCHOICE_PAGEDOWN, "page-down" },
|
||||
{ MODEKEYCHOICE_PAGEUP, "page-up" },
|
||||
{ MODEKEYCHOICE_SCROLLDOWN, "scroll-down" },
|
||||
{ MODEKEYCHOICE_SCROLLUP, "scroll-up" },
|
||||
{ MODEKEYCHOICE_STARTNUMBERPREFIX, "start-number-prefix" },
|
||||
{ MODEKEYCHOICE_STARTOFLIST, "start-of-list"},
|
||||
{ MODEKEYCHOICE_TOPLINE, "top-line"},
|
||||
{ MODEKEYCHOICE_TREE_COLLAPSE, "tree-collapse" },
|
||||
{ MODEKEYCHOICE_TREE_COLLAPSE_ALL, "tree-collapse-all" },
|
||||
{ MODEKEYCHOICE_TREE_EXPAND, "tree-expand" },
|
||||
@ -226,6 +230,12 @@ const struct mode_key_entry mode_key_vi_choice[] = {
|
||||
{ 'j', 0, MODEKEYCHOICE_DOWN },
|
||||
{ 'k', 0, MODEKEYCHOICE_UP },
|
||||
{ 'q', 0, MODEKEYCHOICE_CANCEL },
|
||||
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST },
|
||||
{ 'g', 0, MODEKEYCHOICE_STARTOFLIST },
|
||||
{ 'H', 0, MODEKEYCHOICE_TOPLINE },
|
||||
{ 'L', 0, MODEKEYCHOICE_BOTTOMLINE },
|
||||
{ 'G', 0, MODEKEYCHOICE_ENDOFLIST },
|
||||
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST },
|
||||
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE },
|
||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN },
|
||||
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN },
|
||||
@ -372,6 +382,11 @@ const struct mode_key_entry mode_key_emacs_choice[] = {
|
||||
{ '\r', 0, MODEKEYCHOICE_CHOOSE },
|
||||
{ 'q', 0, MODEKEYCHOICE_CANCEL },
|
||||
{ 'v' | KEYC_ESCAPE, 0, MODEKEYCHOICE_PAGEUP },
|
||||
{ KEYC_HOME, 0, MODEKEYCHOICE_STARTOFLIST },
|
||||
{ '<' | KEYC_ESCAPE, 0, MODEKEYCHOICE_STARTOFLIST },
|
||||
{ 'R' | KEYC_ESCAPE, 0, MODEKEYCHOICE_TOPLINE },
|
||||
{ '>' | KEYC_ESCAPE, 0, MODEKEYCHOICE_ENDOFLIST },
|
||||
{ KEYC_END, 0, MODEKEYCHOICE_ENDOFLIST },
|
||||
{ KEYC_BSPACE, 0, MODEKEYCHOICE_BACKSPACE },
|
||||
{ KEYC_DOWN | KEYC_CTRL, 0, MODEKEYCHOICE_SCROLLDOWN },
|
||||
{ KEYC_DOWN, 0, MODEKEYCHOICE_DOWN },
|
||||
|
4
tmux.h
4
tmux.h
@ -517,14 +517,18 @@ enum mode_key_cmd {
|
||||
|
||||
/* Menu (choice) keys. */
|
||||
MODEKEYCHOICE_BACKSPACE,
|
||||
MODEKEYCHOICE_BOTTOMLINE,
|
||||
MODEKEYCHOICE_CANCEL,
|
||||
MODEKEYCHOICE_CHOOSE,
|
||||
MODEKEYCHOICE_DOWN,
|
||||
MODEKEYCHOICE_ENDOFLIST,
|
||||
MODEKEYCHOICE_PAGEDOWN,
|
||||
MODEKEYCHOICE_PAGEUP,
|
||||
MODEKEYCHOICE_SCROLLDOWN,
|
||||
MODEKEYCHOICE_SCROLLUP,
|
||||
MODEKEYCHOICE_STARTNUMBERPREFIX,
|
||||
MODEKEYCHOICE_STARTOFLIST,
|
||||
MODEKEYCHOICE_TOPLINE,
|
||||
MODEKEYCHOICE_TREE_COLLAPSE,
|
||||
MODEKEYCHOICE_TREE_COLLAPSE_ALL,
|
||||
MODEKEYCHOICE_TREE_EXPAND,
|
||||
|
@ -679,6 +679,29 @@ window_choose_key(struct window_pane *wp, unused struct session *sess, int key)
|
||||
window_choose_prompt_input(WINDOW_CHOOSE_GOTO_ITEM,
|
||||
"Goto Item", wp, key);
|
||||
break;
|
||||
case MODEKEYCHOICE_STARTOFLIST:
|
||||
data->selected = 0;
|
||||
data->top = 0;
|
||||
window_choose_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCHOICE_TOPLINE:
|
||||
data->selected = data->top;
|
||||
window_choose_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCHOICE_BOTTOMLINE:
|
||||
data->selected = data->top + screen_size_y(s) - 1;
|
||||
if (data->selected > items - 1)
|
||||
data->selected = items - 1;
|
||||
window_choose_redraw_screen(wp);
|
||||
break;
|
||||
case MODEKEYCHOICE_ENDOFLIST:
|
||||
data->selected = items - 1;
|
||||
if (screen_size_y(s) < items)
|
||||
data->top = items - screen_size_y(s);
|
||||
else
|
||||
data->top = 0;
|
||||
window_choose_redraw_screen(wp);
|
||||
break;
|
||||
default:
|
||||
idx = window_choose_index_key(data, key);
|
||||
if (idx < 0 || (u_int) idx >= ARRAY_LENGTH(&data->list))
|
||||
|
Loading…
Reference in New Issue
Block a user