Revision: 2790
http://tmux.svn.sourceforge.net/tmux/?rev=2790&view=rev
Author: tcunha
Date: 2012-05-12 14:56:10 +0000 (Sat, 12 May 2012)
Log Message:
-----------
Sync OpenBSD patchset 1106:
Make unbind-key -a work with -t, based on a diff from Kazuhiko Sakaguchi.
Modified Paths:
--------------
trunk/cmd-unbind-key.c
Modified: trunk/cmd-unbind-key.c
===================================================================
--- trunk/cmd-unbind-key.c 2012-05-10 06:04:31 UTC (rev 2789)
+++ trunk/cmd-unbind-key.c 2012-05-12 14:56:10 UTC (rev 2790)
@@ -42,8 +42,8 @@
int
cmd_unbind_key_check(struct args *args)
{
- if (args_has(args, 'a') && (args->argc != 0 || args_has(args, 't')))
- return (-1);
+ if (args_has(args, 'a') && args->argc != 0)
+ return (-1);
if (!args_has(args, 'a') && args->argc != 1)
return (-1);
return (0);
@@ -56,7 +56,19 @@
struct key_binding *bd;
int key;
- if (args_has(args, 'a')) {
+ if (!args_has(args, 'a')) {
+ key = key_string_lookup_string(args->argv[0]);
+ if (key == KEYC_NONE) {
+ ctx->error(ctx, "unknown key: %s", args->argv[0]);
+ return (-1);
+ }
+ } else
+ key = KEYC_NONE;
+
+ if (args_has(args, 't'))
+ return (cmd_unbind_key_table(self, ctx, key));
+
+ if (key == KEYC_NONE) {
while (!RB_EMPTY(&key_bindings)) {
bd = RB_ROOT(&key_bindings);
key_bindings_remove(bd->key);
@@ -64,15 +76,6 @@
return (0);
}
- key = key_string_lookup_string(args->argv[0]);
- if (key == KEYC_NONE) {
- ctx->error(ctx, "unknown key: %s", args->argv[0]);
- return (-1);
- }
-
- if (args_has(args, 't'))
- return (cmd_unbind_key_table(self, ctx, key));
-
if (!args_has(args, 'n'))
key |= KEYC_PREFIX;
key_bindings_remove(key);
@@ -93,6 +96,15 @@
return (-1);
}
+ if (key == KEYC_NONE) {
+ while (!RB_EMPTY(mtab->tree)) {
+ mbind = RB_ROOT(mtab->tree);
+ RB_REMOVE(mode_key_tree, mtab->tree, mbind);
+ xfree(mbind);
+ }
+ return (0);
+ }
+
mtmp.key = key;
mtmp.mode = !!args_has(args, 'c');
if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs