From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7746 invoked from network); 18 Jun 2004 06:56:46 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 18 Jun 2004 06:56:46 -0000 Received: (qmail 20389 invoked from network); 18 Jun 2004 06:55:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Jun 2004 06:55:40 -0000 Received: (qmail 8278 invoked by alias); 18 Jun 2004 06:54:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20075 Received: (qmail 8252 invoked from network); 18 Jun 2004 06:54:11 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 18 Jun 2004 06:54:08 -0000 Received: (qmail 15595 invoked from network); 18 Jun 2004 06:53:09 -0000 Received: from dan.emsphone.com (root@199.67.51.101) by a.mx.sunsite.dk with SMTP; 18 Jun 2004 06:53:07 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i5I6r0XZ034263; Fri, 18 Jun 2004 01:53:00 -0500 (CDT) (envelope-from dan) Date: Fri, 18 Jun 2004 01:52:59 -0500 From: Dan Nelson To: slumos@unlv.nevada.edu Cc: zsh-workers@sunsite.dk Subject: Re: beep and garbage with long commands Message-ID: <20040618065259.GF67368@dan.emsphone.com> References: <861xkf9ccz.fsf@bitty.lumos.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="aM3YZ0Iwxop3KEKx" Content-Disposition: inline In-Reply-To: <861xkf9ccz.fsf@bitty.lumos.us> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=BAYES_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the last episode (Jun 16), slumos@unlv.nevada.edu said: > When entering certain long commands, zsh (at least 4.0.7 and 4.2.0 on > at least FreeBSD and Solaris) beeps and echos parts of the command. > Here's a stupid made-up example: > > [~]0% ls -la | while read line; do echo $line | awk '{print $1 " " $2 " " $3 " " $4 " " $5 "\n"}'; done >|/dev/null; echo > > "}'; done >|/dev/null; echo > [~]0% I bet you have a preexec function that sets your xterm's title bar, right? Either the backslashes or the embedded newline is aborting the escape sequence, you end up with the rest of your command printed onscreen, plus the ^G that was supposed to end the titlebar escape string. I've attached the part of my zshrc file dealing with xterm and screen titles. It strips control characters from the commandline before sending it to xterm. It also sets the window name in screen, so if you use the windows or windowlist command, you can see at a glance what is running in each screen: 0*&$ ./start 1-$ mutt 2@$ irc_irc.ca 3$ ssh_emssr 4$ ssh_emssr 5$ joe_/e Note there are raw control characters in the attached file, so you might not be able to cut'n'paste the text correctly unless you save it. I also have the following in my screenrc, since screen won't write to the xterm titlebar unless the termcap entry has the 'hs' capability. termcapinfo xterm|xterm-color 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' -- Dan Nelson dnelson@allantgroup.com --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=zshrc Content-Transfer-Encoding: quoted-printable SHOST=3D`print -P %m` # strip control chars and replace with "." # result is returned in $reply function _strip() { local i=3D1 reply=3D$1 while (( i <=3D $#1 )) ; do [[ $reply[i] > "=1F" && $reply[i] < "=7F" ]] || reply[i]=3D"." (( i ++ )) done } if [[ $+WINDOW =3D 1 && $TERM =3D screen* ]] ; then PROMPT=3D"(%n@$SHOST.$WINDOW) %B%/>%(#/#/)%b " RPROMPT=3D"%t %D{%m/%d} %l" # set window title to first 10 chars of command # set hardstatus to hostname and first 100 chars of command preexec () { _strip $1 ; echo -En "=1Bk${reply[1,10]:gs/ /_/}=1B\\=1B]0;$S= HOST: ${reply[1,100]}=07" } else PROMPT=3D"(%n@%m) %B%/>%(#/#/)%b " case $TERM in cons25-crt|xterm*|screen*) # set titlebar to first 100 chars of command preexec () { _strip $1 ; echo -En "=1B]0;$SHOST: $reply[1,100]=07" } ;; esac fi # Update titlebar and inform the user of background jobs precmd ()=20 { if [[ $+WINDOW =3D 1 && $TERM =3D screen* ]] ; then # Set the window title to $SHELL # Set hardstatus to hostname print -Pn "=1Bk${SHELL:t}=1B\\\\=1B]0;%m=07" fi case $TERM in # set titlebar to hostname cons25-crt|xterm*|screen*) print -Pn "=1B]0;%m=07" ;; esac =09 if [[ -o interactive ]] ; then jobs -s : fi } --aM3YZ0Iwxop3KEKx--