aboutsummaryrefslogtreecommitdiff
path: root/window-more.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-27 19:29:35 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-27 19:29:35 +0000
commitd95274c5f294ddf1341f66019fee47a35b4f2561 (patch)
treeb0e4b6d58f3c64091a740ab4de2e186549860fd5 /window-more.c
parent13e29dd7b5dfcefdfda6a1dd3c3f78c9cd7f1cc9 (diff)
downloadrtmux-d95274c5f294ddf1341f66019fee47a35b4f2561.tar.gz
rtmux-d95274c5f294ddf1341f66019fee47a35b4f2561.tar.bz2
rtmux-d95274c5f294ddf1341f66019fee47a35b4f2561.zip
Change mode key bindings from big switches into a set of tables. Rather than
lumping them all together, split editing keys from those used in choice/more mode and those for copy/scroll mode. Tidier and clearer, and the first step towards customisable mode keys.
Diffstat (limited to 'window-more.c')
-rw-r--r--window-more.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/window-more.c b/window-more.c
index d92a06a2..a113c4ba 100644
--- a/window-more.c
+++ b/window-more.c
@@ -80,6 +80,7 @@ window_more_init(struct window_pane *wp)
{
struct window_more_mode_data *data;
struct screen *s;
+ int keys;
wp->modedata = data = xmalloc(sizeof *data);
ARRAY_INIT(&data->list);
@@ -89,8 +90,11 @@ window_more_init(struct window_pane *wp)
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
s->mode &= ~MODE_CURSOR;
- mode_key_init(&data->mdata,
- options_get_number(&wp->window->options, "mode-keys"), 0);
+ keys = options_get_number(&wp->window->options, "mode-keys");
+ if (keys == MODEKEY_EMACS)
+ mode_key_init(&data->mdata, mode_key_emacs_choice);
+ else
+ mode_key_init(&data->mdata, mode_key_vi_choice);
return (s);
}
@@ -126,23 +130,23 @@ window_more_key(struct window_pane *wp, unused struct client *c, int key)
struct screen *s = &data->screen;
switch (mode_key_lookup(&data->mdata, key)) {
- case MODEKEYCMD_QUIT:
+ case MODEKEYCHOICE_CANCEL:
window_pane_reset_mode(wp);
break;
- case MODEKEYCMD_UP:
+ case MODEKEYCHOICE_UP:
window_more_scroll_up(wp);
break;
- case MODEKEYCMD_DOWN:
+ case MODEKEYCHOICE_DOWN:
window_more_scroll_down(wp);
break;
- case MODEKEYCMD_PREVIOUSPAGE:
+ case MODEKEYCHOICE_PAGEUP:
if (data->top < screen_size_y(s))
data->top = 0;
else
data->top -= screen_size_y(s);
window_more_redraw_screen(wp);
break;
- case MODEKEYCMD_NEXTPAGE:
+ case MODEKEYCHOICE_PAGEDOWN:
if (data->top + screen_size_y(s) > ARRAY_LENGTH(&data->list))
data->top = ARRAY_LENGTH(&data->list);
else