Revision: 2707 http://tmux.svn.sourceforge.net/tmux/?rev=2707&view=rev Author: tcunha Date: 2012-03-03 09:14:21 +0000 (Sat, 03 Mar 2012) Log Message: ----------- Sync OpenBSD patchset 1031:
Use format for display-message, based on a diff from George Nachman. Modified Paths: -------------- trunk/cmd-display-message.c trunk/tmux.1 Modified: trunk/cmd-display-message.c =================================================================== --- trunk/cmd-display-message.c 2012-03-02 11:23:51 UTC (rev 2706) +++ trunk/cmd-display-message.c 2012-03-03 09:14:21 UTC (rev 2707) @@ -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,26 +48,44 @@ struct window_pane *wp; const char *template; char *msg; + struct format_tree *ft; + char out[BUFSIZ]; + time_t t; if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL) return (-1); - if (args_has(args, 't') != 0) { + if (args_has(args, 't')) { wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp); if (wl == NULL) return (-1); } else { - s = NULL; - wl = NULL; - wp = NULL; + wl = cmd_find_pane(ctx, NULL, &s, &wp); + if (wl == NULL) + return (-1); } - if (args->argc == 0) + if (args_has(args, 'F') && args->argc != 0) { + ctx->error(ctx, "only one of -F or argument must be given"); + return (-1); + } + + template = args_get(args, 'F'); + if (args->argc != 0) + template = args->argv[0]; + if (template == NULL) 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); + ft = format_create(); + format_client(ft, c); + format_session(ft, s); + format_winlink(ft, s, wl); + format_window_pane(ft, wp); + + t = time(NULL); + strftime(out, sizeof out, template, localtime(&t)); + + msg = format_expand(ft, out); if (args_has(self->args, 'p')) ctx->print(ctx, "%s", msg); else Modified: trunk/tmux.1 =================================================================== --- trunk/tmux.1 2012-03-02 11:23:51 UTC (rev 2706) +++ trunk/tmux.1 2012-03-03 09:14:21 UTC (rev 2707) @@ -2994,9 +2994,9 @@ status line. The format of .Ar message -is as for -.Ic status-left , -with the exception that #() are not handled; information is taken from +is described in the +.Sx FORMATS +section; information is taken from .Ar target-pane if .Fl t This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ tmux-cvs mailing list tmux-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-cvs