In a36da3a (Remove the barely-used and unnecessary command check()
function., 2013-08-21) an extra, unconditional, early return was
accidentally inserted when handling unbind-key without the "-a"
option.

Remove this early return to let unbind-keys work to unbind
individual keys.

---

The problem can be demonstrated with the following sequence of commands.

NB: destructively uses a server on the socket named "other"

    echo === setup: ; \
    ./tmux -L other -f /dev/null new -d\; \
      unbind -a\; list-keys\; \
      bind Tab display tab\; bind -n Tab display TAB\; list-keys\; \
      unbind Tab\; unbind -n Tab ; \
    echo === after unbinds: ; \
    ./tmux -L other list-keys\; kill-server

Without the change:

  * The first list-keys shows that "unbind -a" worked: there is no
    output.
  * The second list-keys shows only the two Tab bindings.
  * The first unbind-key silently "fails" (from the early return)
    which prevents the second unbind-key from even being attempted;
    this is why the last list-keys is done from a new client
    connection.
  * The last list-keys still shows the Tab bindings.

Expected:

    Both Tab bindings should have been removed by the time the last
    list-keys runs.

When the extra return is removed unbind-key works properly again.
---
 cmd-unbind-key.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index 9bd068e..cf6ad50 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -47,13 +47,12 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
 
        if (!args_has(args, 'a')) {
                if (args->argc != 1) {
                        cmdq_error(cmdq, "missing key");
                        return (CMD_RETURN_ERROR);
                }
-               return (CMD_RETURN_ERROR);
                key = key_string_lookup_string(args->argv[0]);
                if (key == KEYC_NONE) {
                        cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
                        return (CMD_RETURN_ERROR);
                }
        } else {
-- 
1.8.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to