diff options
Diffstat (limited to 'usr.bin/tmux/key-bindings.c')
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index bff573139ed..711106646c6 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.16 2009/12/10 09:16:52 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.17 2010/02/06 22:55:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -239,7 +239,9 @@ key_bindings_info(struct cmd_ctx *ctx, const char *fmt, ...) void key_bindings_dispatch(struct key_binding *bd, struct client *c) { - struct cmd_ctx ctx; + struct cmd_ctx ctx; + struct cmd *cmd; + int readonly; ctx.msgdata = NULL; ctx.curclient = c; @@ -250,5 +252,15 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c) ctx.cmdclient = NULL; + readonly = 1; + TAILQ_FOREACH(cmd, bd->cmdlist, qentry) { + if (!(cmd->entry->flags & CMD_READONLY)) + readonly = 0; + } + if (!readonly && c->flags & CLIENT_READONLY) { + key_bindings_info(&ctx, "Client is read-only"); + return; + } + cmd_list_exec(bd->cmdlist, &ctx); } |