Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt



Derek Peschel wrote:
>If the left prompt is empty and you enter a blank line (by simply hitting
>return) then the right prompt will be erased.

Also happens if the line being edited ever becomes blank (type "x<DEL>").
The problem is that the refresh logic ignores the prompts a little too
much -- ignoring the rprompt, it thinks the line is meant to be completely
blank, and so it outputs a delete-line sequence.

Historically, the handling of prompts in the refresh code is a little odd.
The refresh code isn't capable of generating the prompt display, because
it doesn't do display attributes -- prompts can switch attributes
arbitrarily, but the main editor buffer all appears with the same
attributes.  Consequently the refresh code only knows where the prompts
are, and has to work around them.  We might want to consider changing
the refresh code to handle attributes, so that we can use attributes
in the main buffer (bold to indicate control characters would be nice,
for example).

I think this patch fixes the problem.  The logic in the conditional in
question does appear to be incorrect, but I'm not certain that there
are no other places where a CLEAREOL can be induced.

Index: zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.4
diff -c -r1.4 zle_refresh.c
*** zle_refresh.c	2001/10/24 07:00:49	1.4
--- zle_refresh.c	2002/01/31 10:40:26
***************
*** 698,704 ****
        which need to be written. do this now to allow some pre-processing */
  
      if (cleareol 		/* request to clear to end of line */
! 	|| !nllen 		/* no line buffer given */
  	|| (ln == 0 && (put_rpmpt != oput_rpmpt))) {	/* prompt changed */
  	p1 = zhalloc(winw + 2);
  	if (nllen)
--- 698,704 ----
        which need to be written. do this now to allow some pre-processing */
  
      if (cleareol 		/* request to clear to end of line */
! 	|| (!nllen && !put_rpmpt)		/* no line buffer given */
  	|| (ln == 0 && (put_rpmpt != oput_rpmpt))) {	/* prompt changed */
  	p1 = zhalloc(winw + 2);
  	if (nllen)

-zefram



Messages sorted by: Reverse Date, Date, Thread, Author