summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2017-02-06 15:00:41 +0000
committernicm <nicm>2017-02-06 15:00:41 +0000
commite67548dc36fdb4454aded1c95bd35e2443191f94 (patch)
tree2e7bb998b44f8feb59b06e9b2fbd9be2b811de5b
parentd150d9b384612c1ee2c52009b996a4466e111049 (diff)
Cancel key table when switching session, unless the key is going to
repeat. Reported by Amos Bird.
-rw-r--r--cmd-attach-session.c2
-rw-r--r--cmd-new-session.c2
-rw-r--r--cmd-switch-client.c2
-rw-r--r--key-bindings.c12
-rw-r--r--tmux.h1
5 files changed, 15 insertions, 4 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index d29c4dd1..e9c23df3 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -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/cmd-new-session.c b/cmd-new-session.c
index 4e7b413b..deda88f2 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -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/cmd-switch-client.c b/cmd-switch-client.c
index 5cf4756f..5bcdbb78 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -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/key-bindings.c b/key-bindings.c
index 4cbb34ec..d96b51f6 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -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/tmux.h b/tmux.h
index 068bcbbe..01503ecb 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1226,6 +1226,7 @@ struct cmdq_item {
struct cmd_list *cmdlist;
struct cmd *cmd;
+ int repeat;
cmdq_cb cb;
void *data;