Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9642

Modified Files:
        cmd-unbind-key.c tmux.1 
Log Message:
PatchSet 784
Date: 2010/11/11 20:54:06
Author: nicm
Branch: HEAD
Tag: (none)
Log:
Flag to flush all key bindings from Rob Paisley.

Members:
        cmd-unbind-key.c:1.7->1.8
        tmux.1:1.188->1.189



Index: cmd-unbind-key.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-unbind-key.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cmd-unbind-key.c    25 Jan 2010 17:12:44 -0000      1.22
+++ cmd-unbind-key.c    6 Dec 2010 21:51:02 -0000       1.23
@@ -33,13 +33,14 @@
 struct cmd_unbind_key_data {
        int     key;
 
+       int     flag_all;
        int     command_key;
        char   *tablename;
 };
 
 const struct cmd_entry cmd_unbind_key_entry = {
        "unbind-key", "unbind",
-       "[-cn] [-t key-table] key",
+       "[-acn] [-t key-table] key",
        0, "",
        NULL,
        cmd_unbind_key_parse,
@@ -55,11 +56,15 @@
        int                              opt, no_prefix = 0;
 
        self->data = data = xmalloc(sizeof *data);
+       data->flag_all = 0;
        data->command_key = 0;
        data->tablename = NULL;
 
-       while ((opt = getopt(argc, argv, "cnt:")) != -1) {
+       while ((opt = getopt(argc, argv, "acnt:")) != -1) {
                switch (opt) {
+               case 'a':
+                       data->flag_all = 1;
+                       break;
                case 'c':
                        data->command_key = 1;
                        break;
@@ -76,15 +81,20 @@
        }
        argc -= optind;
        argv += optind;
-       if (argc != 1)
+       if (data->flag_all && (argc != 0 || data->tablename))
+               goto usage;
+       if (!data->flag_all && argc != 1)
                goto usage;
 
-       if ((data->key = key_string_lookup_string(argv[0])) == KEYC_NONE) {
-               xasprintf(cause, "unknown key: %s", argv[0]);
-               goto error;
+       if (!data->flag_all) {
+               data->key = key_string_lookup_string(argv[0]);
+               if (data->key == KEYC_NONE) {
+                       xasprintf(cause, "unknown key: %s", argv[0]);
+                       goto error;
+               }
+               if (!no_prefix)
+                       data->key |= KEYC_PREFIX;
        }
-       if (!no_prefix)
-               data->key |= KEYC_PREFIX;
 
        return (0);
 
@@ -100,13 +110,23 @@
 cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx)
 {
        struct cmd_unbind_key_data      *data = self->data;
+       struct key_binding              *bd;
 
        if (data == NULL)
                return (0);
-       if (data->tablename != NULL)
-               return (cmd_unbind_key_table(self, ctx));
+       if (data->flag_all) {
+               while (!SPLAY_EMPTY(&key_bindings)) {
+                       bd = SPLAY_ROOT(&key_bindings);
+                       SPLAY_REMOVE(key_bindings, &key_bindings, bd);
+                       cmd_list_free(bd->cmdlist);
+                       xfree(bd);
+               }
+       } else {
+               if (data->tablename != NULL)
+                       return (cmd_unbind_key_table(self, ctx));
 
-       key_bindings_remove(data->key);
+               key_bindings_remove(data->key);
+       }
 
        return (0);
 }

Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -d -r1.270 -r1.271
--- tmux.1      6 Dec 2010 21:49:57 -0000       1.270
+++ tmux.1      6 Dec 2010 21:51:02 -0000       1.271
@@ -14,7 +14,7 @@
 .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: November 1 2010 $
+.Dd $Mdocdate: November 11 2010 $
 .Dt TMUX 1
 .Os
 .Sh NAME
@@ -1479,7 +1479,7 @@
 Send the prefix key to a window as if it was pressed.
 If multiple prefix keys are configured, only the first is sent.
 .It Xo Ic unbind-key
-.Op Fl cn
+.Op Fl acn
 .Op Fl t Ar key-table
 .Ar key
 .Xc
@@ -1493,6 +1493,9 @@
 is specified, the command bound to
 .Ar key
 without a prefix (if any) is removed.
+If
+.Fl a
+is present, all key bindings are removed.
 .Pp
 If
 .Fl t


------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to