As we discussed earlier, this patch adds -F format to display-message.
If -F is passed then that format is used in preference to the
'message' argument.

Index: tmux.1
===================================================================
--- tmux.1      (revision 2697)
+++ tmux.1      (working copy)
@@ -2648,6 +2648,7 @@
 .El
 .Sh FORMATS
 The
+.Ic display-message ,
 .Ic list-clients ,
 .Ic list-sessions ,
 .Ic list-windows
@@ -2979,6 +2980,7 @@
 .Op Fl p
 .Op Fl c Ar target-client
 .Op Fl t Ar target-pane
+.Op Fl F format
 .Op Ar message
 .Xc
 .D1 (alias: Ic display )
@@ -2988,9 +2990,16 @@
 is given, the output is printed to stdout, otherwise it is displayed in the
 .Ar target-client
 status line.
-The format of
+If
+.Fl F
+is given, then
+.Ar format
+defines the message as described in the
+.Sx FORMATS
+section.
+Otherwise,
 .Ar message
-is as for
+defines the message. Its format is as for
 .Ic status-left ,
 with the exception that #() are not handled; information is taken from
 .Ar target-pane
Index: cmd-display-message.c
===================================================================
--- cmd-display-message.c       (revision 2697)
+++ cmd-display-message.c       (working copy)
@@ -30,8 +30,8 @@

 const struct cmd_entry cmd_display_message_entry = {
        "display-message", "display",
-       "c:pt:", 0, 1,
-       "[-p] [-c target-client] [-t target-pane] [message]",
+       "c:pt:F:", 0, 1,
+       "[-p] [-c target-client] [-t target-pane] [-F format] [message]",
        0,
        NULL,
        NULL,
@@ -48,6 +48,7 @@
        struct window_pane      *wp;
        const char              *template;
        char                    *msg;
+       struct format_tree      *ft;

        if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL)
                return (-1);
@@ -62,12 +63,22 @@
                wp = NULL;
        }

-       if (args->argc == 0)
-               template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)";
-       else
-               template = args->argv[0];
+       template = args_get(args, 'F');
+       if (template != NULL) {
+               ft = format_create();
+               format_session(ft, s);
+               format_winlink(ft, s, wl);
+               format_window_pane(ft, wp);

-       msg = status_replace(c, s, wl, wp, template, time(NULL), 0);
+               msg = format_expand(ft, template);
+       } else {
+               if (args->argc == 0)
+                       template = "[#S] #I:#W, current pane #P - (%H:%M 
%d-%b-%y)";
+               else
+                       template = args->argv[0];
+
+               msg = status_replace(c, s, wl, wp, template, time(NULL), 0);
+       }
        if (args_has(self->args, 'p'))
                ctx->print(ctx, "%s", msg);
        else

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to