From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13305 invoked from network); 13 Feb 2009 10:04:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Feb 2009 10:04:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 17105 invoked from network); 13 Feb 2009 08:20:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Feb 2009 08:20:59 -0000 Received: (qmail 25758 invoked by alias); 13 Feb 2009 08:20:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13839 Received: (qmail 25744 invoked from network); 13 Feb 2009 08:20:20 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Feb 2009 08:20:20 -0000 Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 7A68B80271F0 for ; Fri, 13 Feb 2009 09:20:15 +0100 (CET) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id n1D8KA5G095433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 13 Feb 2009 02:20:10 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n1D8K9U2015014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 13 Feb 2009 02:20:10 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n1D8K8e9014991; Fri, 13 Feb 2009 02:20:08 -0600 (CST) (envelope-from dan) Date: Fri, 13 Feb 2009 02:20:08 -0600 From: Dan Nelson To: Matthew Flaschen Cc: zsh-users@sunsite.dk Subject: Re: /usr/bin/printf Message-ID: <20090213082008.GA87583@dan.emsphone.com> References: <4994CFCF.2090408@gatech.edu> <237967ef0902121751k37dd810co312238682d9b60f0@mail.gmail.com> <4994E32E.2050508@gatech.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <4994E32E.2050508@gatech.edu> X-OS: FreeBSD 7.1-STABLE User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on email1.allantgroup.com X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Fri, 13 Feb 2009 02:20:10 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 X-Virus-Scanned: ClamAV 0.92.1/8986/Fri Feb 13 07:46:56 2009 on bifrost X-Virus-Status: Clean In the last episode (Feb 12), Matthew Flaschen said: > Mikael Magnusson wrote: > > This is because your preexec() function is broken and is outputting the > > newline from the cmdline without escaping it, which makes your terminal > > stop reading the title, and the rest of the command line is just echoed= =2E=20 > > This is kind of hard to figure out the first time. >=20 > Okay, here's my preexec. I admit I don't understand this syntax yet: >=20 > preexec () { print -Pn "\e]0;%n@%m: $1\a" } >=20 > I got it from > http://web.archive.org/web/20071224181948/www.princeton.edu/~kmccarty/zsh= =2Ehtml >=20 > Do you know how I would correct it? Here's what I use. Possibly overkill. The extra escape string in the $+WINDOW=3D1 case truncate the window names within screen to 10 chars so th= at "^A W" can still display a lot of titles even if your commandline in window 1 is long. Truncating the title itself to 100 characters helps if you're editing a huge commandline (say you manually expanded a 500-arg wildcard for some reason; no need to send all that to xterm). # 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] > $'\C-_' && $reply[i] < $'\C-?' ]] || reply[i]=3D"." (( i ++ )) done } SHOST=3D$(print -P %m) if [[ $+WINDOW =3D 1 && $TERM =3D screen* ]] ; then preexec () { _strip $1 ; echo -En "=1Bk${reply[1,10]:gs/ /_/}=1B\\=1B]0;$= SHOST: ${reply[1,100]}=07" } else case $TERM in xterm*|screen*) preexec () { _strip $1 ; echo -En "=1B]0;$SHOST: $reply[1,100]=07" } = ;; esac fi --=20 Dan Nelson dnelson@allantgroup.com