The branch, master has been updated
       via  6bdc947f6b8616e45ed0cf742ad143d138d3d6e2 (commit)
      from  919bde7cb1e8961cfb474013bded00f81ae58435 (commit)

- Log -----------------------------------------------------------------
commit 6bdc947f6b8616e45ed0cf742ad143d138d3d6e2
Author: Nicholas Marriott <[email protected]>
Commit: Nicholas Marriott <[email protected]>

    Handle no client better in display-message.
---
 cmd-display-message.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/cmd-display-message.c b/cmd-display-message.c
index 4ff3f97..485ccf0 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -70,6 +70,18 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q 
*cmdq)
                return (CMD_RETURN_ERROR);
        }
 
+       if (args_has(args, 'c')) {
+           c = cmd_find_client(cmdq, args_get(args, 'c'), 0);
+           if (c == NULL)
+               return (CMD_RETURN_ERROR);
+       } else {
+               c = cmd_current_client(cmdq);
+               if (c == NULL && !args_has(self->args, 'p')) {
+                       cmdq_error(cmdq, "no client available");
+                       return (CMD_RETURN_ERROR);
+               }
+       }
+
        template = args_get(args, 'F');
        if (args->argc != 0)
                template = args->argv[0];
@@ -77,7 +89,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
                template = DISPLAY_MESSAGE_TEMPLATE;
 
        ft = format_create();
-       if ((c = cmd_find_client(cmdq, args_get(args, 'c'), 1)) != NULL)
+       if (c != NULL)
                format_client(ft, c);
        format_session(ft, s);
        format_winlink(ft, s, wl);
@@ -90,10 +102,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q 
*cmdq)
        msg = format_expand(ft, out);
        if (args_has(self->args, 'p'))
                cmdq_print(cmdq, "%s", msg);
-       else if (c == NULL) {
-               cmdq_error(cmdq, "no client available");
-               return (CMD_RETURN_ERROR);
-       } else
+       else
                status_message_set(c, "%s", msg);
        free(msg);
        format_free(ft);


-----------------------------------------------------------------------

Summary of changes:
 cmd-display-message.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to