about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-07-30 12:26:03 +0100
committerPeter Stephenson <pws@zsh.org>2014-07-30 12:26:03 +0100
commit15db636380a6010c8486b3a7dc27188c96beff9c (patch)
tree71e626f711bd0e00352b60dd329e911474dabf96
parentd3d091029367d7bf3c413330a2e93d720614d211 (diff)
downloadzsh-15db636380a6010c8486b3a7dc27188c96beff9c.tar.gz
zsh-15db636380a6010c8486b3a7dc27188c96beff9c.tar.xz
zsh-15db636380a6010c8486b3a7dc27188c96beff9c.zip
%P at start of TCP function system prompt causes %-style prompt subst
-rw-r--r--ChangeLog10
-rw-r--r--Doc/Zsh/tcpsys.yo4
-rw-r--r--Functions/TCP/tcp_output3
3 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f71458516..f415e4803 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,12 @@
 2014-07-30  Peter Stephenson  <p.stephenson@samsung.com>
 
-	* 32918: Doc/Zsh/prompt.yo, Functions/TCP/tcp_output,
-	Src/builtin.c,Src/prompt.c, Src/utils.c, Src/watch.c: add
-	ability to display times with fractions of a second in prompts.
+	* 32919: Doc/Zsh/tcpsys.yo Functions/TCP/tcp_output: %P
+	at start of prompt in TCP function system causes standard
+	%-style substitution.
+
+	* 32918: Doc/Zsh/prompt.yo, Src/builtin.c,Src/prompt.c,
+	Src/utils.c, Src/watch.c: add ability to display times with
+	fractions of a second in prompts.
 
 2014-07-28  Barton E. Schaefer  <schaefer@zsh.org>
 
diff --git a/Doc/Zsh/tcpsys.yo b/Doc/Zsh/tcpsys.yo
index 599335bc9..1e26054ce 100644
--- a/Doc/Zsh/tcpsys.yo
+++ b/Doc/Zsh/tcpsys.yo
@@ -666,6 +666,10 @@ expression `tt(%c)' expands to 1 if the session being read is the current
 session, else 0; this is most useful in ternary expressions such as
 `tt(%LPAR()c.-.PLUS()RPAR())' which outputs `tt(PLUS())' if the session is
 the current one, else `tt(-)'.
+
+If the prompt starts with tt(%P), this is stripped and the complete
+result of the previous stage is passed through standard prompt tt(%)-style
+formatting before being output.
 )
 vindex(TCP_READ_DEBUG)
 item(tt(TCP_READ_DEBUG))(
diff --git a/Functions/TCP/tcp_output b/Functions/TCP/tcp_output
index 781c46c33..22e818e17 100644
--- a/Functions/TCP/tcp_output
+++ b/Functions/TCP/tcp_output
@@ -35,6 +35,9 @@ if [[ -n $tprompt ]]; then
       cursess="c:0"
   fi
   zformat -f REPLY $tprompt "s:$sess" "f:$read_fd" $cursess
+  if [[ $REPLY = %P* ]]; then
+    REPLY=${(%)${REPLY##%P}}
+  fi
   # We will pass this back up.
   REPLY="$REPLY$*"
 else