summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
diff options
context:
space:
mode:
authornicm <nicm>2019-11-20 11:42:51 +0000
committernicm <nicm>2019-11-20 11:42:51 +0000
commit3c312a915094fe566c323aee35387d144cdeb6b2 (patch)
tree861b1b29baa822514cf2d54c2e88cf529e492b86 /key-bindings.c
parent350a43493952e1f10173b4e341ff1fbd8ed8440d (diff)
Do not check the client readonly flag when there is no client, GitHub issue 1980.
Diffstat (limited to 'key-bindings.c')
-rw-r--r--key-bindings.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/key-bindings.c b/key-bindings.c
index c90924a5..a2534b44 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -508,12 +508,16 @@ key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
struct cmdq_item *new_item;
int readonly;
- readonly = 1;
- TAILQ_FOREACH(cmd, &bd->cmdlist->list, qentry) {
- if (!(cmd->entry->flags & CMD_READONLY))
- readonly = 0;
+ if (c == NULL || (~c->flags & CLIENT_READONLY))
+ readonly = 1;
+ else {
+ readonly = 1;
+ TAILQ_FOREACH(cmd, &bd->cmdlist->list, qentry) {
+ if (~cmd->entry->flags & CMD_READONLY)
+ readonly = 0;
+ }
}
- if (!readonly && (c->flags & CLIENT_READONLY))
+ if (!readonly)
new_item = cmdq_get_callback(key_bindings_read_only, NULL);
else {
new_item = cmdq_get_command(bd->cmdlist, fs, m, 0);