zsh-workers
 help / color / mirror / code / Atom feed
* Bug with the new prompt redraw code
@ 2004-07-11  3:47 Bart Schaefer
  2004-07-11 13:09 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2004-07-11  3:47 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-13  5:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-11  3:47 Bug with the new prompt redraw code Bart Schaefer
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

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).