From 76d6d3641f271be1756e41494960d96714e7ee58 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 11 Oct 2016 07:23:34 +0000 Subject: Fundamental change to how copy mode key bindings work: The vi-copy and emacs-copy mode key tables are gone, and instead copy mode commands are bound in one of two normal key tables ("copy-mode" or "copy-mode-vi"). Keys are bound to "send-keys -X copy-mode-command". So: bind -temacs-copy C-Up scroll-up bind -temacs-copy -R5 WheelUpPane scroll-up Becomes: bind -Tcopy-mode C-Up send -X scroll-up bind -Tcopy-mode WheelUpPane send -N5 -X scroll-up This allows the full command parser and command set to be used - for example, we can use the normal command prompt for searching, jumping, and so on instead of a custom one: bind -Tcopy-mode C-r command-prompt -p'search up' "send -X search-backward '%%'" command-prompt also gets a -1 option to only require on key press, which is needed for jumping. The plan is to get rid of mode keys entirely, so more to come eventually. --- window-choose.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'window-choose.c') diff --git a/window-choose.c b/window-choose.c index 715915b6..19677c86 100644 --- a/window-choose.c +++ b/window-choose.c @@ -52,10 +52,10 @@ enum window_choose_input_type { }; const struct window_mode window_choose_mode = { - window_choose_init, - window_choose_free, - window_choose_resize, - window_choose_key, + .init = window_choose_init, + .free = window_choose_free, + .resize = window_choose_resize, + .key = window_choose_key, }; struct window_choose_mode_item { @@ -552,7 +552,7 @@ window_choose_key(struct window_pane *wp, __unused struct client *c, items = data->list_size; if (data->input_type == WINDOW_CHOOSE_GOTO_ITEM) { - switch (mode_key_lookup(&data->mdata, key, NULL, NULL)) { + switch (mode_key_lookup(&data->mdata, key)) { case MODEKEYCHOICE_CANCEL: data->input_type = WINDOW_CHOOSE_NORMAL; window_choose_redraw_screen(wp); @@ -582,7 +582,7 @@ window_choose_key(struct window_pane *wp, __unused struct client *c, return; } - switch (mode_key_lookup(&data->mdata, key, NULL, NULL)) { + switch (mode_key_lookup(&data->mdata, key)) { case MODEKEYCHOICE_CANCEL: window_choose_fire_callback(wp, NULL); break; @@ -837,7 +837,7 @@ window_choose_key_index(struct window_choose_mode_data *data, u_int idx) int mkey; for (ptr = keys; *ptr != '\0'; ptr++) { - mkey = mode_key_lookup(&data->mdata, *ptr, NULL, NULL); + mkey = mode_key_lookup(&data->mdata, *ptr); if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER) continue; if (idx-- == 0) @@ -857,7 +857,7 @@ window_choose_index_key(struct window_choose_mode_data *data, key_code key) u_int idx = 0; for (ptr = keys; *ptr != '\0'; ptr++) { - mkey = mode_key_lookup(&data->mdata, *ptr, NULL, NULL); + mkey = mode_key_lookup(&data->mdata, *ptr); if (mkey != MODEKEY_NONE && mkey != MODEKEY_OTHER) continue; if (key == (key_code)*ptr) -- cgit