zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Bug with the new prompt redraw code
Date: Sat, 10 Jul 2004 20:47:38 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.60.0407102039330.24945@toltec.zanshin.com> (raw)

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.


             reply	other threads:[~2004-07-11  3:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-11  3:47 Bart Schaefer [this message]
2004-07-11 13:09 ` Peter Stephenson
2004-07-11 16:44   ` Bart Schaefer
2004-07-11 22:42     ` Peter Stephenson
2004-07-12 16:28       ` Bart Schaefer
2004-07-12 17:53         ` Peter Stephenson
2004-07-13  5:08           ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.60.0407102039330.24945@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).