aboutsummaryrefslogtreecommitdiff
path: root/cmd-bind-key.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-07-25 08:52:04 +0000
committerTiago Cunha <tcunha@gmx.com>2009-07-25 08:52:04 +0000
commit28cf7dc39ed54a49567204c951ada1681af44734 (patch)
tree2c259016303d7dd0b82089ed64de7f89cd78f8f2 /cmd-bind-key.c
parent744ccb7cc933c6e433a3b4a4c889364540689829 (diff)
downloadrtmux-28cf7dc39ed54a49567204c951ada1681af44734.tar.gz
rtmux-28cf7dc39ed54a49567204c951ada1681af44734.tar.bz2
rtmux-28cf7dc39ed54a49567204c951ada1681af44734.zip
Sync OpenBSD patchset 175:
Permit commands to be bound to key presses without the prefix key first. The new -n flag to bind-key and unbind-key sets or removes these bindings, and list-key shows them in []s.
Diffstat (limited to 'cmd-bind-key.c')
-rw-r--r--cmd-bind-key.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 393bc46e..041a1f3d 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-bind-key.c,v 1.22 2009-07-14 06:43:32 nicm Exp $ */
+/* $Id: cmd-bind-key.c,v 1.23 2009-07-25 08:52:04 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -39,7 +39,7 @@ struct cmd_bind_key_data {
const struct cmd_entry cmd_bind_key_entry = {
"bind-key", "bind",
- "[-r] key command [arguments]",
+ "[-nr] key command [arguments]",
0, 0,
NULL,
cmd_bind_key_parse,
@@ -54,14 +54,17 @@ int
cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
{
struct cmd_bind_key_data *data;
- int opt;
+ int opt, no_prefix = 0;
self->data = data = xmalloc(sizeof *data);
data->can_repeat = 0;
data->cmdlist = NULL;
- while ((opt = getopt(argc, argv, "r")) != -1) {
+ while ((opt = getopt(argc, argv, "nr")) != -1) {
switch (opt) {
+ case 'n':
+ no_prefix = 1;
+ break;
case 'r':
data->can_repeat = 1;
break;
@@ -78,6 +81,8 @@ cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
xasprintf(cause, "unknown key: %s", argv[0]);
goto error;
}
+ if (!no_prefix)
+ data->key |= KEYC_PREFIX;
argc--;
argv++;