From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11381 invoked by alias); 30 Jul 2014 11:22:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32919 Received: (qmail 21897 invoked from network); 30 Jul 2014 11:22:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7f776d000003e54-65-53d8d554a55c Date: Wed, 30 Jul 2014 12:21:54 +0100 From: Peter Stephenson To: Peter Stephenson Cc: Zsh Hackers' List Subject: Re: PATCH: ztrftime %. for fractions of a second in prompts Message-id: <20140730122154.1a4346a8@pwslap01u.europe.root.pri> In-reply-to: <20140730114651.5687f4df@pwslap01u.europe.root.pri> References: <20140730114651.5687f4df@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrILMWRmVeSWpSXmKPExsVy+t/xK7ohV28EG1yusDi69gezxcHmh0wO TB59W1Yxeqw6+IEpgCmKyyYlNSezLLVI3y6BK+Pnla9MBV3cFb0zdrM1MDZydjFyckgImEhs 3LiDDcIWk7hwbz2QzcUhJLCUUeL7sxPsEE4/k8THtplMIFUsAqoSs+YuYwex2QQMJaZums0I YosI6EusXdnDDGIzC2hLbJ3aBGYLC7hI/Fs9EayXV8Be4vf+SWBxTgEHiaadn4DmcAAtsJe4 tTMcJMwPNObq309MEAfZS8y8coYRolVQ4sfkeywQ47UkNm9rYoWw5SU2r3nLPIFRcBaSsllI ymYhKVvAyLyKUTS1NLmgOCk910ivODG3uDQvXS85P3cTIyRYv+5gXHrM6hCjAAejEg9vwbsr wUKsiWXFlbmHGCU4mJVEePvW3ggW4k1JrKxKLcqPLyrNSS0+xMjEwSnVwNh2e+qc6dZqT/U9 vYveK9bduP7l8fSSR5P7GTS4Kpf6KMt5KnXn5Draz9Zuq3ZWdav+HXb/0HT57AXaL955nJlx isHvwsaPkZ87uM7oVMQy3PWacMVpQ0z0LdXAyh3SAmc3ti5o+CLx8FVx+O5Z3++9/zbj0Blx Y6aqiK8au8TZNj7Lk//LflmJpTgj0VCLuag4EQA30d6INAIAAA== On Wed, 30 Jul 2014 11:46:51 +0100 Peter Stephenson wrote: > I was trying to get some timings in prompts to better than a second --- > not particularly useful in a regular shell prompt, but very useful in > the prompts provided by e.g. the TCP functions. This requires some further massaging. pws diff --git a/Doc/Zsh/tcpsys.yo b/Doc/Zsh/tcpsys.yo index 599335b..1e26054 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 781c46c..22e818e 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