From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11039 invoked from network); 11 Jul 2004 03:48:16 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 11 Jul 2004 03:48:16 -0000 Received: (qmail 11179 invoked from network); 11 Jul 2004 03:50:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Jul 2004 03:50:24 -0000 Received: (qmail 8486 invoked by alias); 11 Jul 2004 03:47:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20146 Received: (qmail 8476 invoked from network); 11 Jul 2004 03:47:52 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 11 Jul 2004 03:47:52 -0000 Received: (qmail 10928 invoked from network); 11 Jul 2004 03:50:16 -0000 Received: from unknown (HELO moonbase.zanshin.com) (@167.160.213.139) by a.mx.sunsite.dk with SMTP; 11 Jul 2004 03:50:03 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i6B3lcCE012815 for ; Sat, 10 Jul 2004 20:47:38 -0700 Date: Sat, 10 Jul 2004 20:47:38 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-workers@sunsite.dk To: zsh-workers@sunsite.dk Subject: Bug with the new prompt redraw code Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Consider the following: PS1_first_line=$'%{\e[1;32m%}[%d]%{\e[0m%}\n' PS1_second_line=$'%{\e[1;34m%}[%T]%{\e[1;32m%}%%%{\e[0m%} ' precmd() { PS1="$PS1_first_line$PS1_second_line" } zle-line-init() { PS1="$PS1_second_line" } zle -N zle-line-init This was intended to cause zsh to redraw only the second line of the two- line prompt at any time other than completely starting over with a new command. Instead it has the effect of printing a garbage prompt. This appears to occur because (1) zle-line-init runs before the prompt is displayed, which seems odd but wouldn't be a big deal except that (2) the prompt printing code has stashed a pointer to the value of $PS1, which ends up pointing at reclaimed memory when PS1 is re-assigned.