From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8516 invoked from network); 4 Nov 2007 17:48:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Nov 2007 17:48:43 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 35073 invoked from network); 4 Nov 2007 17:48:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Nov 2007 17:48:35 -0000 Received: (qmail 27089 invoked by alias); 4 Nov 2007 17:48:28 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12187 Received: (qmail 27072 invoked from network); 4 Nov 2007 17:48:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Nov 2007 17:48:27 -0000 Received: (qmail 33920 invoked from network); 4 Nov 2007 17:48:27 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 4 Nov 2007 17:48:21 -0000 Received: from torch.brasslantern.com ([71.116.71.62]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JQZ0098MTG5OO66@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 04 Nov 2007 11:48:06 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id lA4Hm4kS022630 for ; Sun, 04 Nov 2007 09:48:05 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id lA4Hm377022629 for zsh-users@sunsite.dk; Sun, 04 Nov 2007 09:48:03 -0800 Date: Sun, 04 Nov 2007 09:48:03 -0800 From: Bart Schaefer Subject: Re: since 4.3.4, artifact-appearance at prompt In-reply-to: <20071104070008.15348.qmail@smasher.org> To: zsh-users@sunsite.dk Message-id: <071104094803.ZM22628@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20071103234335.GB10499@panix.com> <071103183038.ZM8388@torch.brasslantern.com> <20071104034810.GA3923@panix.com> <20071104070008.15348.qmail@smasher.org> Comments: In reply to Atom Smasher "Re: since 4.3.4, artifact-appearance at prompt" (Nov 4, 8:00pm) On Nov 4, 8:00pm, Atom Smasher wrote: } } > On Sat, 3 Nov 2007, Russell Hoover wrote: } > "%" on a blank line where I'm not sure it's doing me any good (when my } > prompt is already on the next line). Note in passing: You're not supposed to see the % on a blank line. The PROMPT_SP trick is supposed to emit just enough spaces so that, *if* the line is blank, then when the PROMP_CR carriage return is printed, you'll be returned to the position where the % appears and the normal prompt will cover it up. This is why I say you're either in a race condition -- e.g., zsh prints the spaces but before it can backspace and print the prompt, you hit enter again and the teminal advances to the next line [*] -- or there's something unexpected about the right-margin auto-wrap behavior of your terminal, such that the PROMPT_SP spaces cause a new line where one should not be. [*] I can't make this happen no matter how fast I hammer on the enter key, so I suspect this is related to other problems with slow prompts. Ok, that got windier than I intended. Back to the real reply: On Nov 4, 8:00pm, Atom Smasher wrote: } } would it be reasonable to have an SPPROMPT parameter, or something } similar, to control what's displayed there? It wouldn't be unreasonable, but it would require the prompt_sp code to be able to compute the exact visible width of that substitution -- that is, users would have to be just as careful with %{ and %} as they are in the prompt itself, maybe more so. If you want to control what appears there, you can unsetopt prompt_sp and insert the equivalent sequence into your PS1 string or precmd function, as described in FAQ 3.23: # Skip defining precmd if the PROMPT_SP option is available. if ! eval '[[ -o promptsp ]] 2>/dev/null'; then function precmd { # An efficient version using termcap multi-right: print -nP '%B%S%#%s%b' # Output % or # echotc RI $((COLUMNS - 3)) echo -n ' ' # Output 2 spaces } fi If you change the "print -nP" string to be wider, increase the "3" in the echotc to compensate. It should always be 2 more than the width of the print output. A suggestion I'll throw out in case someone feels like running with it: Perhaps there should be a %-expando for PS1 that performs the "echotc RI" of the correct width based on the current %(l..) value (if you see what I mean), followed by the two spaces. Suppose that's %P (not necessarily the best choice, just the first unused letter to come to mind). Then one could just do PS1="%B%S%#%s%b%P$PS1" and customize the part to the left of the %P any way they like. Or %P could take an "argument" like %D does, if that would be easier: PS1=%P{%B%S%#%s%b}$PS1" Any thoughts from the -workers on that?