diff options
author | 2017-02-06 15:00:41 +0000 | |
---|---|---|
committer | 2017-02-06 15:00:41 +0000 | |
commit | 0036f4092a4363fa81038ab8078a4a950db45cc5 (patch) | |
tree | 3c43b0df2d851af032e25b735e4f470669b7507d | |
parent | Fix logging of CSI parameters. (diff) | |
download | wireguard-openbsd-0036f4092a4363fa81038ab8078a4a950db45cc5.tar.xz wireguard-openbsd-0036f4092a4363fa81038ab8078a4a950db45cc5.zip |
Cancel key table when switching session, unless the key is going to
repeat. Reported by Amos Bird.
-rw-r--r-- | usr.bin/tmux/cmd-attach-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-switch-client.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
5 files changed, 20 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 9fe022b39b4..4baef01a664 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.68 2017/02/03 11:57:27 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.69 2017/02/06 15:00:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -98,6 +98,8 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, environ_update(s->options, c->environ, s->environ); c->session = s; + if (!item->repeat) + server_client_set_key_table(c, NULL); status_timer_start(c); notify_client("client-session-changed", c); session_update_activity(s, NULL); diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index cc0002082ff..66bbf39ceda 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.99 2017/02/03 11:57:27 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.100 2017/02/06 15:00:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -277,6 +277,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) } else if (c->session != NULL) c->last_session = c->session; c->session = s; + if (!item->repeat) + server_client_set_key_table(c, NULL); status_timer_start(c); notify_client("client-session-changed", c); session_update_activity(s, NULL); diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index d95feeb8086..775b545b2d1 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.47 2017/01/28 16:11:27 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.48 2017/02/06 15:00:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -108,6 +108,8 @@ cmd_switch_client_exec(struct cmd *self, struct cmdq_item *item) if (c->session != NULL && c->session != s) c->last_session = c->session; c->session = s; + if (!item->repeat) + server_client_set_key_table(c, NULL); status_timer_start(c); session_update_activity(s, NULL); gettimeofday(&s->last_attached_time, NULL); diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index a627342ab59..62c8b5588d2 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.72 2017/01/24 19:53:37 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.73 2017/02/06 15:00:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -400,8 +400,9 @@ void key_bindings_dispatch(struct key_binding *bd, struct client *c, struct mouse_event *m, struct cmd_find_state *fs) { - struct cmd *cmd; - int readonly; + struct cmd *cmd; + struct cmdq_item *item; + int readonly; readonly = 1; TAILQ_FOREACH(cmd, &bd->cmdlist->list, qentry) { @@ -410,6 +411,9 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c, } if (!readonly && (c->flags & CLIENT_READONLY)) cmdq_append(c, cmdq_get_callback(key_bindings_read_only, NULL)); - else - cmdq_append(c, cmdq_get_command(bd->cmdlist, fs, m, 0)); + else { + item = cmdq_get_command(bd->cmdlist, fs, m, 0); + item->repeat = bd->can_repeat; + cmdq_append(c, item); + } } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 7965b63dc2b..dfbafbb01a4 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.713 2017/02/06 13:23:00 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.714 2017/02/06 15:00:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1226,6 +1226,7 @@ struct cmdq_item { struct cmd_list *cmdlist; struct cmd *cmd; + int repeat; cmdq_cb cb; void *data; |