diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-04-22 10:05:54 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-04-22 10:05:54 +0100 |
commit | 0a88377086329786c438d4973365fdb21186f4e4 (patch) | |
tree | df5b091b400df84974f58bbfbb78ee26ccb9a5f6 /cmd-switch-client.c | |
parent | b25dc423b0b1369aaec5dee8e051d541bd55043f (diff) | |
parent | 3909aff06aa6de748ae057cab1e723eec2387edd (diff) | |
download | rtmux-0a88377086329786c438d4973365fdb21186f4e4.tar.gz rtmux-0a88377086329786c438d4973365fdb21186f4e4.tar.bz2 rtmux-0a88377086329786c438d4973365fdb21186f4e4.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-switch-client.c')
-rw-r--r-- | cmd-switch-client.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 439f593b..8c4daf97 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -31,8 +31,8 @@ enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_switch_client_entry = { "switch-client", "switchc", - "lc:npt:r", 0, 0, - "[-lnpr] [-c target-client] [-t target-session]", + "lc:npt:rT:", 0, 0, + "[-lnpr] [-c target-client] [-t target-session] [-T key-table]", CMD_READONLY, cmd_switch_client_exec }; @@ -46,7 +46,8 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) struct winlink *wl = NULL; struct window *w = NULL; struct window_pane *wp = NULL; - const char *tflag; + const char *tflag, *tablename; + struct key_table *table; if ((c = cmd_find_client(cmdq, args_get(args, 'c'), 0)) == NULL) return (CMD_RETURN_ERROR); @@ -58,6 +59,18 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) c->flags |= CLIENT_READONLY; } + tablename = args_get(args, 'T'); + if (tablename != NULL) { + table = key_bindings_get_table(tablename, 0); + if (table == NULL) { + cmdq_error(cmdq, "table %s doesn't exist", tablename); + return (CMD_RETURN_ERROR); + } + table->references++; + key_bindings_unref_table(c->keytable); + c->keytable = table; + } + tflag = args_get(args, 't'); if (args_has(args, 'n')) { if ((s = session_next_session(c->session)) == NULL) { |