diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-28 07:03:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-28 07:03:33 +0000 |
commit | 91b609484f4b8d3135cdb26cb6db6f7c4cdc97fc (patch) | |
tree | 3d9cf96a6e9085b6170fa11b36c3ae156b3cb12e /usr.bin/tmux | |
parent | 8ac01f5403feb01127486cf04aaa8261b2e2725e (diff) |
Next step towards customisable mode keys: build each default table of keys into
a named tree on start and use that for lookups. Also add command to string
translation tables and modify list-keys to show the the mode key bindings (new
-t argument).
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 65 | ||||
-rw-r--r-- | usr.bin/tmux/mode-key.c | 183 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/status.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 41 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 58 | ||||
-rw-r--r-- | usr.bin/tmux/window-choose.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window-more.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window-scroll.c | 6 |
10 files changed, 322 insertions, 59 deletions
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 3b2cf857153..31129f30dd7 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.5 2009/07/26 12:58:44 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.6 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -28,25 +28,31 @@ int cmd_list_keys_exec(struct cmd *, struct cmd_ctx *); +int cmd_list_keys_table(struct cmd *, struct cmd_ctx *); + const struct cmd_entry cmd_list_keys_entry = { "list-keys", "lsk", - "", + "[-t key-table]", 0, 0, - NULL, - NULL, + cmd_target_init, + cmd_target_parse, cmd_list_keys_exec, - NULL, - NULL + cmd_target_free, + cmd_target_print }; int -cmd_list_keys_exec(unused struct cmd *self, struct cmd_ctx *ctx) +cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) { + struct cmd_target_data *data = self->data; struct key_binding *bd; const char *key; char tmp[BUFSIZ], keytmp[64]; int width, keywidth; + if (data->target != NULL) + return (cmd_list_keys_table(self, ctx)); + width = 0; SPLAY_FOREACH(bd, key_bindings, &key_bindings) { key = key_string_lookup_key(bd->key & ~KEYC_PREFIX); @@ -76,3 +82,48 @@ cmd_list_keys_exec(unused struct cmd *self, struct cmd_ctx *ctx) return (0); } + +int +cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx) +{ + struct cmd_target_data *data = self->data; + const struct mode_key_table *mtab; + struct mode_key_binding *mbind; + const char *key, *cmdstr, *mode; + int width, keywidth; + + for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { + if (strcasecmp(data->target, mtab->name) == 0) + break; + } + if (mtab->name == NULL) { + ctx->error(ctx, "unknown key table: %s", data->target); + return (-1); + } + + width = 0; + SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) { + key = key_string_lookup_key(mbind->key); + if (key == NULL) + continue; + + keywidth = strlen(key) + 1; + if (keywidth > width) + width = keywidth; + } + + SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) { + key = key_string_lookup_key(mbind->key); + if (key == NULL) + continue; + + mode = ""; + if (mbind->mode != 0) + mode = "(command mode) "; + cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd); + if (cmdstr != NULL) + ctx->print(ctx, "%*s: %s%s", width, key, mode, cmdstr); + } + + return (0); +} diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index b63772af836..df0c6e66fc4 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.9 2009/07/27 20:36:13 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.10 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -20,6 +20,71 @@ #include "tmux.h" +/* + * Mode keys. These are the key bindings used when editing (status prompt), and + * in the modes. They are split into two sets of three tables, one set of three + * for vi and the other for emacs key bindings. The three tables are for + * editing, for menu-like modes (choice, more), and for copy modes (copy, + * scroll). + * + * The fixed tables of struct mode_key_entry below are the defaults: they are + * built into a tree of struct mode_key_binding by mode_key_init_trees, which + * can then be modified. + * + * vi command mode is handled by having a mode flag in the struct which allows + * two sets of bindings to be swapped between. A couple of editing commands + * (MODEKEYEDIT_SWITCHMODE and MODEKEYEDIT_SWITCHMODEAPPEND) are special-cased + * to do this. + */ + +/* Edit keys command strings. */ +struct mode_key_cmdstr mode_key_cmdstr_edit[] = { + { MODEKEYEDIT_BACKSPACE, "backspace" }, + { MODEKEYEDIT_CANCEL, "cancel" }, + { MODEKEYEDIT_COMPLETE, "complete" }, + { MODEKEYEDIT_CURSORLEFT, "cursor-left" }, + { MODEKEYEDIT_CURSORRIGHT, "cursor-right" }, + { MODEKEYEDIT_DELETE, "delete" }, + { MODEKEYEDIT_DELETETOENDOFLINE, "delete-end-of-line" }, + { MODEKEYEDIT_ENDOFLINE, "end-of-line" }, + { MODEKEYEDIT_ENTER, "enter" }, + { MODEKEYEDIT_HISTORYDOWN, "history-down" }, + { MODEKEYEDIT_HISTORYUP, "history-up" }, + { MODEKEYEDIT_PASTE, "paste" }, + { MODEKEYEDIT_STARTOFLINE, "start-of-line" }, + { MODEKEYEDIT_SWITCHMODE, "switch-mode" }, + { MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" }, +}; + +/* Choice keys command strings. */ +struct mode_key_cmdstr mode_key_cmdstr_choice[] = { + { MODEKEYCHOICE_CANCEL, "cancel" }, + { MODEKEYCHOICE_CHOOSE, "choose" }, + { MODEKEYCHOICE_DOWN, "down" }, + { MODEKEYCHOICE_PAGEDOWN, "page-down" }, + { MODEKEYCHOICE_PAGEUP, "page-up" }, + { MODEKEYCHOICE_UP, "up" }, +}; + +/* Copy keys command strings. */ +struct mode_key_cmdstr mode_key_cmdstr_copy[] = { + { MODEKEYCOPY_CANCEL, "cancel" }, + { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, + { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, + { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, + { MODEKEYCOPY_DOWN, "cursor-down" }, + { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, + { MODEKEYCOPY_LEFT, "cursor-left" }, + { MODEKEYCOPY_NEXTPAGE, "page-down" }, + { MODEKEYCOPY_NEXTWORD, "next-word" }, + { MODEKEYCOPY_PREVIOUSPAGE, "page-up" }, + { MODEKEYCOPY_PREVIOUSWORD, "previous-word" }, + { MODEKEYCOPY_RIGHT, "cursor-right" }, + { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, + { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, + { MODEKEYCOPY_UP, "cursor-up" }, +}; + /* vi editing keys. */ const struct mode_key_entry mode_key_vi_edit[] = { { '\003' /* C-c */, 0, MODEKEYEDIT_CANCEL }, @@ -53,6 +118,7 @@ const struct mode_key_entry mode_key_vi_edit[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_vi_edit; /* vi choice selection keys. */ const struct mode_key_entry mode_key_vi_choice[] = { @@ -68,6 +134,7 @@ const struct mode_key_entry mode_key_vi_choice[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_vi_choice; /* vi copy mode keys. */ const struct mode_key_entry mode_key_vi_copy[] = { @@ -98,6 +165,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_vi_copy; /* emacs editing keys. */ const struct mode_key_entry mode_key_emacs_edit[] = { @@ -123,6 +191,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_emacs_edit; /* emacs choice selection keys. */ const struct mode_key_entry mode_key_emacs_choice[] = { @@ -137,6 +206,7 @@ const struct mode_key_entry mode_key_emacs_choice[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_emacs_choice; /* emacs copy mode keys. */ const struct mode_key_entry mode_key_emacs_copy[] = { @@ -168,34 +238,105 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { 0, -1, 0 } }; +struct mode_key_tree mode_key_tree_emacs_copy; + +/* Table mapping key table names to default settings and trees. */ +const struct mode_key_table mode_key_tables[] = { + { "vi-edit", mode_key_cmdstr_edit, + &mode_key_tree_vi_edit, mode_key_vi_edit }, + { "vi-choice", mode_key_cmdstr_choice, + &mode_key_tree_vi_choice, mode_key_vi_choice }, + { "vi-copy", mode_key_cmdstr_copy, + &mode_key_tree_vi_copy, mode_key_vi_copy }, + { "emacs-edit", mode_key_cmdstr_edit, + &mode_key_tree_emacs_edit, mode_key_emacs_edit }, + { "emacs-choice", mode_key_cmdstr_choice, + &mode_key_tree_emacs_choice, mode_key_emacs_choice }, + { "emacs-copy", mode_key_cmdstr_copy, + &mode_key_tree_emacs_copy, mode_key_emacs_copy }, + + { NULL, NULL, NULL, NULL } +}; + +SPLAY_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); + +int +mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2) +{ + if (mbind1->mode != mbind2->mode) + return (mbind1->mode - mbind2->mode); + return (mbind1->key - mbind2->key); +} + +const char * +mode_key_tostring(struct mode_key_cmdstr *cmdstr, enum mode_key_cmd cmd) +{ + for (; cmdstr->name != NULL; cmdstr++) { + if (cmdstr->cmd == cmd) + return (cmdstr->name); + } + return (NULL); +} void -mode_key_init(struct mode_key_data *mdata, const struct mode_key_entry *table) +mode_key_init_trees(void) { - mdata->table = table; + const struct mode_key_table *mtab; + const struct mode_key_entry *ment; + struct mode_key_binding *mbind; + + for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { + SPLAY_INIT(mtab->tree); + for (ment = mtab->table; ment->mode != -1; ment++) { + mbind = xmalloc(sizeof *mbind); + mbind->key = ment->key; + mbind->mode = ment->mode; + mbind->cmd = ment->cmd; + SPLAY_INSERT(mode_key_tree, mtab->tree, mbind); + } + } +} + +void +mode_key_free_trees(void) +{ + const struct mode_key_table *mtab; + struct mode_key_binding *mbind; + + for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { + while (!SPLAY_EMPTY(mtab->tree)) { + mbind = SPLAY_ROOT(mtab->tree); + SPLAY_REMOVE(mode_key_tree, mtab->tree, mbind); + } + } +} + +void +mode_key_init(struct mode_key_data *mdata, struct mode_key_tree *mtree) +{ + mdata->tree = mtree; mdata->mode = 0; } enum mode_key_cmd mode_key_lookup(struct mode_key_data *mdata, int key) { - const struct mode_key_entry *ment; - int mode; - - mode = mdata->mode; - for (ment = mdata->table; ment->mode != -1; ment++) { - if (ment->mode == mode && key == ment->key) { - switch (ment->cmd) { - case MODEKEYEDIT_SWITCHMODE: - case MODEKEYEDIT_SWITCHMODEAPPEND: - mdata->mode = 1 - mdata->mode; - /* FALLTHROUGH */ - default: - return (ment->cmd); - } - } + struct mode_key_binding *mbind, mtmp; + + mtmp.key = key; + mtmp.mode = mdata->mode; + if ((mbind = SPLAY_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) { + if (mdata->mode != 0) + return (MODEKEY_NONE); + return (MODEKEY_OTHER); + } + + switch (mbind->cmd) { + case MODEKEYEDIT_SWITCHMODE: + case MODEKEYEDIT_SWITCHMODEAPPEND: + mdata->mode = 1 - mdata->mode; + /* FALLTHROUGH */ + default: + return (mbind->cmd); } - if (mode != 0) - return (MODEKEY_NONE); - return (MODEKEY_OTHER); } diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 90981597fd7..48ea7660f7f 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.14 2009/07/24 14:52:47 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.15 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -160,6 +160,7 @@ server_start(char *path) ARRAY_INIT(&windows); ARRAY_INIT(&clients); ARRAY_INIT(&sessions); + mode_key_init_trees(); key_bindings_init(); utf8_build(); @@ -379,6 +380,7 @@ server_main(int srv_fd) } ARRAY_FREE(&clients); + mode_key_free_trees(); key_bindings_free(); close(srv_fd); diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 3d88fdaf307..1f78c5dd9ed 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.20 2009/07/27 19:29:35 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.21 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -609,9 +609,9 @@ status_prompt_set(struct client *c, const char *msg, keys = options_get_number(&c->session->options, "status-keys"); if (keys == MODEKEY_EMACS) - mode_key_init(&c->prompt_mdata, mode_key_emacs_edit); + mode_key_init(&c->prompt_mdata, &mode_key_tree_emacs_edit); else - mode_key_init(&c->prompt_mdata, mode_key_vi_edit); + mode_key_init(&c->prompt_mdata, &mode_key_tree_vi_edit); c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE); c->flags |= CLIENT_STATUS; diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 0444cfda9bb..80d8a2ff869 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.47 2009/07/28 06:48:44 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.48 2009/07/28 07:03:32 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -331,10 +331,29 @@ The following keys are supported as appropriate for the mode: .It Li "Cursor right" Ta "l" Ta "Right" .It Li "Start selection" Ta "Space" Ta "C-Space" .It Li "Cursor up" Ta "k" Ta "Up" -.It Li "Delete to end of line" Ta "D or C" Ta "C-k" +.It Li "Delete to end of line" Ta "D" Ta "C-k" .It Li "Paste buffer" Ta "p" Ta "C-y" .El .Pp +These key bindings are defined in a set of named tables: +.Em vi-edit +and +.Em emacs-edit +for keys used when line editing at the command prompt; +.Em vi-choice +and +.Em emacs-choice +for keys used when choosing from lists (such as produced by the +.Ic window-choose +command) or in output mode; and +.Em vi-copy +and +.Em emacs-copy +used in copy and scroll modes. +The tables may be viewed with the +.Ic list-keys +command. +.Pp The paste buffer key pastes the first line from the top paste buffer on the stack. .Sh BUFFERS @@ -847,13 +866,31 @@ List all clients attached to the server. List the syntax of all commands supported by .Nm . .It Xo Ic list-keys +.Op Ar Fl t Ar key-table .Xc .D1 (alias: Ic lsk ) List all key bindings. +Without +.Fl t +the primary key bindings - those executed when preceded by the prefix key - +are printed. Keys bound without the prefix key (see .Ic bind-key .Fl n ) are enclosed in square brackets. +.Pp +With +.Fl t , +the key bindings in +.Ar key-table +are listed; this may be one of: +.Em vi-edit , +.Em emacs-edit , +.Em vi-choice , +.Em emacs-choice , +.Em vi-copy +or +.Em emacs-copy . .It Xo Ic list-sessions .Xc .D1 (alias: Ic ls ) diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index d933be1b468..598c6d0dcc5 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.61 2009/07/28 06:48:44 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.62 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -356,7 +356,7 @@ struct msg_unlock_data { char pass[PASS_MAX]; }; -/* Editing keys. */ +/* Mode key commands. */ enum mode_key_cmd { MODEKEY_NONE, MODEKEY_OTHER, @@ -404,6 +404,7 @@ enum mode_key_cmd { MODEKEYCOPY_UP, }; +/* Entry in the default mode key tables. */ struct mode_key_entry { int key; @@ -414,16 +415,42 @@ struct mode_key_entry { * keys to be bound in edit mode. */ int mode; - enum mode_key_cmd cmd; }; + +/* Data required while mode keys are in use. */ struct mode_key_data { - const struct mode_key_entry *table; - int mode; + struct mode_key_tree *tree; + int mode; }; #define MODEKEY_EMACS 0 #define MODEKEY_VI 1 +/* Binding between a key and a command. */ +struct mode_key_binding { + int key; + + int mode; + enum mode_key_cmd cmd; + + SPLAY_ENTRY(mode_key_binding) entry; +}; +SPLAY_HEAD(mode_key_tree, mode_key_binding); + +/* Command to string mapping. */ +struct mode_key_cmdstr { + enum mode_key_cmd cmd; + const char *name; +}; + +/* Named mode key table description. */ +struct mode_key_table { + const char *name; + struct mode_key_cmdstr *cmdstr; + struct mode_key_tree *tree; + const struct mode_key_entry *table; /* default entries */ +}; + /* Modes. */ #define MODE_CURSOR 0x1 #define MODE_INSERT 0x2 @@ -1061,14 +1088,19 @@ void sighandler(int); int load_cfg(const char *, char **x); /* mode-key.c */ -extern const struct mode_key_entry mode_key_vi_edit[]; -extern const struct mode_key_entry mode_key_vi_choice[]; -extern const struct mode_key_entry mode_key_vi_copy[]; -extern const struct mode_key_entry mode_key_emacs_edit[]; -extern const struct mode_key_entry mode_key_emacs_choice[]; -extern const struct mode_key_entry mode_key_emacs_copy[]; -void mode_key_init( - struct mode_key_data *, const struct mode_key_entry *); +extern const struct mode_key_table mode_key_tables[]; +extern struct mode_key_tree mode_key_tree_vi_edit; +extern struct mode_key_tree mode_key_tree_vi_choice; +extern struct mode_key_tree mode_key_tree_vi_copy; +extern struct mode_key_tree mode_key_tree_emacs_edit; +extern struct mode_key_tree mode_key_tree_emacs_choice; +extern struct mode_key_tree mode_key_tree_emacs_copy; +int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *); +SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); +const char *mode_key_tostring(struct mode_key_cmdstr *r, enum mode_key_cmd); +void mode_key_init_trees(void); +void mode_key_free_trees(void); +void mode_key_init(struct mode_key_data *, struct mode_key_tree *); enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int); /* options.c */ diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c index efe81dfede9..56b75d4cf4a 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.5 2009/07/27 19:29:35 nicm Exp $ */ +/* $OpenBSD: window-choose.c,v 1.6 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -127,9 +127,9 @@ window_choose_init(struct window_pane *wp) keys = options_get_number(&wp->window->options, "mode-keys"); if (keys == MODEKEY_EMACS) - mode_key_init(&data->mdata, mode_key_emacs_choice); + mode_key_init(&data->mdata, &mode_key_tree_emacs_choice); else - mode_key_init(&data->mdata, mode_key_vi_choice); + mode_key_init(&data->mdata, &mode_key_tree_vi_choice); return (s); } diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 6dd71fd694c..ad6a6cbbb9d 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.11 2009/07/27 20:36:13 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.12 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -108,9 +108,9 @@ window_copy_init(struct window_pane *wp) keys = options_get_number(&wp->window->options, "mode-keys"); if (keys == MODEKEY_EMACS) - mode_key_init(&data->mdata, mode_key_emacs_copy); + mode_key_init(&data->mdata, &mode_key_tree_emacs_copy); else - mode_key_init(&data->mdata, mode_key_vi_copy); + mode_key_init(&data->mdata, &mode_key_tree_vi_copy); s->cx = data->cx; s->cy = data->cy; diff --git a/usr.bin/tmux/window-more.c b/usr.bin/tmux/window-more.c index 79e8dc8c814..26eb516ca54 100644 --- a/usr.bin/tmux/window-more.c +++ b/usr.bin/tmux/window-more.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-more.c,v 1.5 2009/07/27 19:29:35 nicm Exp $ */ +/* $OpenBSD: window-more.c,v 1.6 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -92,9 +92,9 @@ window_more_init(struct window_pane *wp) keys = options_get_number(&wp->window->options, "mode-keys"); if (keys == MODEKEY_EMACS) - mode_key_init(&data->mdata, mode_key_emacs_choice); + mode_key_init(&data->mdata, &mode_key_tree_emacs_choice); else - mode_key_init(&data->mdata, mode_key_vi_choice); + mode_key_init(&data->mdata, &mode_key_tree_vi_choice); return (s); } diff --git a/usr.bin/tmux/window-scroll.c b/usr.bin/tmux/window-scroll.c index 1caf79b4bd2..a0a40c2f2b2 100644 --- a/usr.bin/tmux/window-scroll.c +++ b/usr.bin/tmux/window-scroll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-scroll.c,v 1.4 2009/07/27 20:36:13 nicm Exp $ */ +/* $OpenBSD: window-scroll.c,v 1.5 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -75,9 +75,9 @@ window_scroll_init(struct window_pane *wp) keys = options_get_number(&wp->window->options, "mode-keys"); if (keys == MODEKEY_EMACS) - mode_key_init(&data->mdata, mode_key_emacs_copy); + mode_key_init(&data->mdata, &mode_key_tree_emacs_copy); else - mode_key_init(&data->mdata, mode_key_vi_copy); + mode_key_init(&data->mdata, &mode_key_tree_vi_copy); screen_write_start(&ctx, NULL, s); for (i = 0; i < screen_size_y(s); i++) |