Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv21658

Modified Files:
        cmd-command-prompt.c tmux.1 
Log Message:
Sync OpenBSD patchset 917:

Pass prompts through status_replace so that they can be more helpful
(such as showing the previous session name when renaming). From Tiago
Cunha.


Index: cmd-command-prompt.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-command-prompt.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- cmd-command-prompt.c        7 Jan 2011 15:04:51 -0000       1.30
+++ cmd-command-prompt.c        22 May 2011 16:26:38 -0000      1.31
@@ -82,7 +82,7 @@
        const char                      *prompts;
        struct cmd_command_prompt_cdata *cdata;
        struct client                   *c;
-       char                            *prompt, *ptr;
+       char                            *prompt, *prompt_replaced, *ptr;
        size_t                           n;
 
        if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
@@ -116,8 +116,12 @@
        ptr = strsep(&cdata->next_prompt, ",");
        if (prompts == NULL)
                prompt = xstrdup(ptr);
-       else
-               xasprintf(&prompt, "%s ", ptr);
+       else {
+               prompt_replaced = status_replace(c, NULL, NULL, NULL, ptr,
+                   time(NULL), 0);
+               xasprintf(&prompt, "%s ", prompt_replaced);
+               xfree(prompt_replaced);
+       }
        status_prompt_set(c, prompt, cmd_command_prompt_callback,
            cmd_command_prompt_free, cdata, 0);
        xfree(prompt);
@@ -133,6 +137,7 @@
        struct cmd_list                 *cmdlist;
        struct cmd_ctx                   ctx;
        char                            *cause, *newtempl, *prompt, *ptr;
+       char                            *prompt_replaced;
 
        if (s == NULL)
                return (0);
@@ -142,8 +147,12 @@
        cdata->template = newtempl;
 
        if ((ptr = strsep(&cdata->next_prompt, ",")) != NULL) {
-               xasprintf(&prompt, "%s ", ptr);
+               prompt_replaced = status_replace(c, NULL, NULL, NULL, ptr,
+                   time(NULL), 0);
+               xasprintf(&prompt, "%s ", prompt_replaced);
                status_prompt_update(c, prompt);
+
+               xfree(prompt_replaced);
                xfree(prompt);
                cdata->idx++;
                return (1);

Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.316
retrieving revision 1.317
diff -u -d -r1.316 -r1.317
--- tmux.1      22 May 2011 16:26:09 -0000      1.316
+++ tmux.1      22 May 2011 16:26:38 -0000      1.317
@@ -1259,7 +1259,7 @@
 .Ar shell-command
 string may contain the special character sequences supported by the
 .Ic status-left
-command.
+option.
 If no
 .Ar shell-command
 is given, the current pipe (if any) is closed.
@@ -2628,6 +2628,7 @@
 This may be used from inside
 .Nm
 to execute commands interactively.
+.Pp
 If
 .Ar template
 is specified, it is used as the command.
@@ -2641,6 +2642,12 @@
 if it is present, or
 .Ql \&:
 if not.
+The
+.Ar prompts
+may contain the special character sequences supported by the
+.Ic status-left
+option.
+.Pp
 Before the command is executed, the first occurrence of the string
 .Ql %%
 and all occurrences of


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to