zsh-workers
 help / color / mirror / code / Atom feed
* BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt
@ 2002-01-31  8:44 Derek Peschel
  2002-01-31 10:42 ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Derek Peschel @ 2002-01-31  8:44 UTC (permalink / raw)
  To: zsh-workers

I wrote "BUG?" instead of "BUG" because this behavior is kind of cute.
Probably it was unintended, however.  And the right thing to do (which
I am NOT volunteering for, since I don't think it's important) is to
add a bunch of options -- transient_prompt, transient_prompt_blank_line,
transient_rprompt_blank_line, etc.

The behavior affects the released 4.0.2, as well as today's daily 4.1
snapshot.  I haven't tested 4.0.4 (it seems not to compile on my system)
but undoubtedly it works the same way.

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

This is strange in 4.0.2 since it has no transient_rprompt option,
so there's no other way of erasing the right prompt!  With the daily
snapshot the transient_rprompt option is ignored.

The logic for displaying the right prompt (in Src/Zle/zle_refresh.c)
checks trashedzle.  Perhaps the combination of the empty prompt and
empty line means that trashedzle is never set.  (I haven't actually
tested this theory.)  But in that case why does the right prompt get
displayed at all?

-- Derek


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

* Re: BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt
  2002-01-31  8:44 BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt Derek Peschel
@ 2002-01-31 10:42 ` Zefram
  2002-01-31 10:49   ` Zefram
  0 siblings, 1 reply; 3+ messages in thread
From: Zefram @ 2002-01-31 10:42 UTC (permalink / raw)
  To: Derek Peschel; +Cc: zsh-workers

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


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

* Re: BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt
  2002-01-31 10:42 ` Zefram
@ 2002-01-31 10:49   ` Zefram
  0 siblings, 0 replies; 3+ messages in thread
From: Zefram @ 2002-01-31 10:49 UTC (permalink / raw)
  To: zsh-workers; +Cc: Derek Peschel

Zefram wrote:
>I think this patch fixes the problem.

Actually that was a little more conservative than necessary.  Here's a
better patch:

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:48:59
***************
*** 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 && (ln != 0 || !put_rpmpt))	/* no line buffer given */
  	|| (ln == 0 && (put_rpmpt != oput_rpmpt))) {	/* prompt changed */
  	p1 = zhalloc(winw + 2);
  	if (nllen)

-zefram


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

end of thread, other threads:[~2002-01-31 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31  8:44 BUG? - 4.0.2, current 4.1 - blank left prompt & blank line erases right prompt Derek Peschel
2002-01-31 10:42 ` Zefram
2002-01-31 10:49   ` Zefram

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