From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6951 invoked by alias); 6 Aug 2014 07:57:45 -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: 32967 Received: (qmail 8430 invoked from network); 6 Aug 2014 07:57:34 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140806005719.ZM28961@torch.brasslantern.com> Date: Wed, 06 Aug 2014 00:57:19 -0700 In-reply-to: <140805005445.ZM27314@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Possible bug to RPROMPT" (Aug 5, 12:54am) References: <201408041950.s74Jo1PS001579@pws-pc.ntlworld.com> <140804135036.ZM1983@torch.brasslantern.com> <140805005445.ZM27314@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Possible bug to RPROMPT MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 5, 12:54am, Bart Schaefer wrote: } Subject: Re: Possible bug to RPROMPT } } PS1="%-40<<$PS1" } } and then you always have 40 characters in which to type. It belatedly } occurs to me that you can *already* get this with } } setopt promptsubst } PS1='%$((COLUMNS-40))<<'"$PS1" I should have pointed out that these aren't fully equivalent unless they appear at the "left end" of the prompt, because of course the first one truncates more of the prompt the farther to the right it appears, whereas the second always truncates the same. However, there's some odd behavior when the computed result is actually zero or less; it's then treated as %<< (i.e., as if with no numeric argument), and no truncation occurs at all. That's very unintuitive, but it stems from being able to use %<< as an end marker for a preceding truncation. Merely documenting this doesn't seem sufficient. On the other hand, a similar odd thing happens with positive truncation because of implicit line wrapping; try %90>=> followed by 100+ characters on an 80-column terminal to see what I mean.