Changes cmd_print to return an offset that does not include the trailing
'\0' when the command has no arguments.

---

One effect of this is that it allows bind-key to work with command
sequences that contain commands with no arguments. For example, the
following bind for R does not work without this patch:
        bind R send-prefix \; display-message "done 1"
        bind S send-prefix -2 \; display-message "done 2"

Index: cmd.c
===================================================================
--- cmd.c       (revision 2775)
+++ cmd.c       (working copy)
@@ -303,11 +303,10 @@ cmd_print(struct cmd *cmd, char *buf, size_t len)
        if (off < len) {
                used = args_print(cmd->args, buf + off, len - off);
                if (used == 0)
-                       buf[off - 1] = '\0';
-               else {
+                       off--;
+               else
                        off += used;
-                       buf[off] = '\0';
-               }
+               buf[off] = '\0';
        }
        return (off);
 }

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to