summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-03-31 21:36:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-03-31 21:36:44 +0000
commit8fe4c7041a496e8f3273ba22ebd417872f39af65 (patch)
tree391d20f40d1c1adc1e8c8e9d23773152e4c8d317 /usr.bin
parent1558bb18ac1e137f5ec27d30be10af34eaabe353 (diff)
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 later from Marcel Partap.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/mode-key.c17
-rw-r--r--usr.bin/tmux/tmux.h6
-rw-r--r--usr.bin/tmux/window-choose.c25
3 files changed, 45 insertions, 3 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c
index f5546031467..4cf250a3891 100644
--- a/usr.bin/tmux/mode-key.c
+++ b/usr.bin/tmux/mode-key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-key.c,v 1.56 2014/02/14 12:35:58 nicm Exp $ */
+/* $OpenBSD: mode-key.c,v 1.57 2014/03/31 21:36:43 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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 },
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 2e7316fa7a0..e7c4e66cba3 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.438 2014/03/31 21:34:08 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.439 2014/03/31 21:36:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -520,14 +520,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,
diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c
index 1c4dbdae5bb..1ca7124554a 100644
--- a/usr.bin/tmux/window-choose.c
+++ b/usr.bin/tmux/window-choose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-choose.c,v 1.50 2014/01/28 23:07:09 nicm Exp $ */
+/* $OpenBSD: window-choose.c,v 1.51 2014/03/31 21:36:43 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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))