zsh-users
 help / color / mirror / code / Atom feed
* clear to end of display
@ 2000-03-18  9:18 Danny Dulai
  2000-03-18 10:54 ` clear to end of display / clear to end of line Danny Dulai
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Dulai @ 2000-03-18  9:18 UTC (permalink / raw)
  To: zsh-users

Every time ZLE prints the prompt, I get a ^[[K (erase display) printed out.
It occurs on the character right before the prompt is printed. If I
unsetopt zle, it stops printing, so ZLE is probably at fault.

I'm wondering why this happens, and how can I turn it off. Bash does not
exhibit this havior.

A source modification for myself is fine, I just can't figure out where its
happening.

-- 
___________________________________________________________________________
Danny Dulai                                           Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/                            nirva@ishiboo.com


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

* Re: clear to end of display / clear to end of line
  2000-03-18  9:18 clear to end of display Danny Dulai
@ 2000-03-18 10:54 ` Danny Dulai
  2000-03-18 18:10   ` clear to end of display Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Dulai @ 2000-03-18 10:54 UTC (permalink / raw)
  To: zsh-users

On 03/18/00, Danny Dulai said:
>Every time ZLE prints the prompt, I get a ^[[K (erase display) printed out.
>It occurs on the character right before the prompt is printed. If I
>unsetopt zle, it stops printing, so ZLE is probably at fault.
>
>I'm wondering why this happens, and how can I turn it off. Bash does not
>exhibit this havior.
>
>A source modification for myself is fine, I just can't figure out where its
>happening.

Its also printing out a ^[[K at the end of the prompt. i thought the %E was
supposed to clear to end of line. I have no %E and yet its still generating
this esc seq to clear the line.

-- 
___________________________________________________________________________
Danny Dulai                                           Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/                            nirva@ishiboo.com


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

* Re: clear to end of display
  2000-03-18 10:54 ` clear to end of display / clear to end of line Danny Dulai
@ 2000-03-18 18:10   ` Bart Schaefer
  2000-03-18 22:55     ` Danny Dulai
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2000-03-18 18:10 UTC (permalink / raw)
  To: Danny Dulai, zsh-users

On Mar 18,  9:18am, Danny Dulai wrote:
} Subject: clear to end of display
}
} Every time ZLE prints the prompt, I get a ^[[K (erase display) printed out.
} It occurs on the character right before the prompt is printed. If I
} unsetopt zle, it stops printing, so ZLE is probably at fault.

[In another message]
} Its also printing out a ^[[K at the end of the prompt. i thought the %E was
} supposed to clear to end of line. I have no %E and yet its still generating
} this esc seq to clear the line.

What you should be seeing is a clear-to-end-of-display before the prompt
is printed, and a clear-to-end-of-line after it.  It's suspicious that
you get the same thing both times, so the termcap/terminfo description
of your terminal may be messed up.  If what you're actually getting is
clear-screen-and-home-cursor, termcap/terminfo is _badly_ messed up.

The %E sequence is for use in prompts that move the cursor around inside
%{...%} blocks and need to erase lines that may be above the prompt.

What's the problem with having a clear-eol after the prompt?

[Back in the first message]
} I'm wondering why this happens, and how can I turn it off. Bash does not
} exhibit this havior.

I believe this has to do with the always_last_prompt option -- the code
that prints the prompt wants to be sure that there's a clean slate below
the prompt where it can display completion listings.  However, it's a
bit too aggressive; it performs the clear-eod whenever it's "safe" to do
so (that is, whenever there's no completion listing there already that
needs to continue to be seen) and not just whenever it's necessary to do
so (which it -almost- never is when always_last_prompt is not set).

The problem is with that -almost-.  The following patch makes zle use
clear-eod less aggressively, but I'm not confident that it won't leave
garbage characters visible when some part of the completion system is
drawing on the screen.  I don't *think* there are any problems, because
the completion list code prints its own clear-eod (at least in 3.1.6+),
but only Geoff and Sven would know for certain.

It may also be that there's a better way to do this; the change below
makes prompt display slightly less efficient by causing it to emit a
clear-eol (or a string of spaces if the terminal can't clear-eol) after
each line it prints (that's the effect of cleareol = 1).  That shouldn't
make much difference if you don't have a multi-line prompt.

The "Index" line is relative to the 3.1.6 sources, but this will also
apply to Src/zle_refresh.c in 3.0.7.  Note to zsh-workers, I don't think
we should include this patch "officially" until at least Geoff has had a
chance to comment on it.

Index: Src/Zle/zle_refresh.c
===================================================================
@@ -333,7 +333,7 @@
 	tsetcap(TCUNDERLINEEND, 0);
 
         if (!clearflag) {
-            if (tccan(TCCLEAREOD))
+            if (tccan(TCCLEAREOD) && isset(ALWAYSLASTPROMPT))
                 tcout(TCCLEAREOD);
             else
                 cleareol = 1;   /* request: clear to end of line */

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: clear to end of display
  2000-03-18 18:10   ` clear to end of display Bart Schaefer
@ 2000-03-18 22:55     ` Danny Dulai
  2000-03-19  3:50       ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Dulai @ 2000-03-18 22:55 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On 03/18/00, Bart Schaefer said:
>What you should be seeing is a clear-to-end-of-display before the prompt
>is printed, and a clear-to-end-of-line after it.  It's suspicious that
>you get the same thing both times, so the termcap/terminfo description
>of your terminal may be messed up.  If what you're actually getting is
>clear-screen-and-home-cursor, termcap/terminfo is _badly_ messed up.

oh, no.. I guess I phrased that badly.. its doing exactly what you said..
clear eod before prompt, clear eol after prompt.

>The %E sequence is for use in prompts that move the cursor around inside
>%{...%} blocks and need to erase lines that may be above the prompt.
>
>What's the problem with having a clear-eol after the prompt?

Well, I have a prompt that displays the time and my login/host in the upper
right of the screen. when the prompt is on the first two lines of the
terminal, the line the prompt is on gets cleared to eol, and overwrites
some of my prompt in the upper right. I have hacks in there so that clear,
^L, and reset, do an echo twice to move the cursor down two lines, but I
was hoping to avoid that.

Also, the reason eod is annoying me is due to uneccessary clears on a
transparent terminal that cause it to slightly flicker. I know this is the
fault of the terminal program, but its a fault I'd like to work around,
since it can't be fixed very easily.

Offtopic:

Transparency can either copy the X window behind it, or it can just let it
fall trhough to the parent window. the fall through method is really fast
and takes no extra resources. One technique to tint the window using
transparency is when you clear the window, you overwrite it with a giant
block of a single color, but you set the graphics context to do an xor or
and or some other bitwise function built into X. That extra draw is what
causes the flicker, sometimes. It really only happens on huge terminal
windows, and avoiding it as much as possible would be nice.

-- 
___________________________________________________________________________
Danny Dulai                                           Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/                            nirva@ishiboo.com


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

* Re: clear to end of display
  2000-03-18 22:55     ` Danny Dulai
@ 2000-03-19  3:50       ` Bart Schaefer
  2000-03-19  7:08         ` Danny Dulai
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2000-03-19  3:50 UTC (permalink / raw)
  To: Danny Dulai; +Cc: zsh-users

On Mar 18, 10:55pm, Danny Dulai wrote:
} Subject: Re: clear to end of display
}
} On 03/18/00, Bart Schaefer said:
} >What's the problem with having a clear-eol after the prompt?
} 
} Well, I have a prompt that displays the time and my login/host in the upper
} right of the screen.

If it's always in the upper right, you might try printing it with a
TRAPALRM() function rather than putting it in the prompt.  Time values
in the prompt don't get updated until after the next call to precmd(),
but by setting a TMOUT value you can have it updated almost as often
as you like (though I wouldn't recommend more often than about every
10 seconds or it'll interfere with your typing).  I update the time
in my xterm title bar that way, with a 60-second TMOUT.

} when the prompt is on the first two lines of the
} terminal, the line the prompt is on gets cleared to eol, and overwrites
} some of my prompt in the upper right. I have hacks in there so that clear,
} ^L, and reset, do an echo twice to move the cursor down two lines, but I
} was hoping to avoid that.

Try putting a cursor-up cursor-down movement in a %{...%} block at the
beginning of your prompt.  That should force the prompt to be no higher
than the second line without needing to hack any zle widgets.  E.g. in
3.1.6+ with an 80-column xterm:

PS1="%{"$'\e7\e[1A\e[1B\e[1;1H'%E$'\e[1;72H'"%D{%I:%M:%S}"$'\e8'"%}%m%# "

} Also, the reason eod is annoying me is due to uneccessary clears on a
} transparent terminal that cause it to slightly flicker. I know this is the
} fault of the terminal program, but its a fault I'd like to work around,
} since it can't be fixed very easily.

Here's a trick that should work ...

Copy your transparent terminal's termcap or terminfo entry to another
name and remove the clear-eod capability.  Suppose the names are `trans'
for the original and `trans_no_ceod' for the edited copy.  Then do:

precmd() { TERM=trans_no_ceod }
preexec() { export TERM=trans }

This hides the clear-eod from zsh while the prompt is printing, without
hiding it from other commands that run.  If you're using a termcap-based
system, you should be able to use the TERMCAP variable instead, and just
insert and delete the `cd=' capability without changing TERM.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: clear to end of display
  2000-03-19  3:50       ` Bart Schaefer
@ 2000-03-19  7:08         ` Danny Dulai
  2000-03-19  7:49           ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Danny Dulai @ 2000-03-19  7:08 UTC (permalink / raw)
  To: zsh-users

>If it's always in the upper right, you might try printing it with a
>TRAPALRM() function rather than putting it in the prompt.  Time values
>in the prompt don't get updated until after the next call to precmd(),
>but by setting a TMOUT value you can have it updated almost as often
>as you like (though I wouldn't recommend more often than about every
>10 seconds or it'll interfere with your typing).  I update the time
>in my xterm title bar that way, with a 60-second TMOUT.

That sounded like a good idea until I tried it out. xterms scrolled back
jump down, and often the time is not there because I'm a obsessive clearer
of my screen.

I went back to the prompt method and used the method you describe below and
everything is ok now.

>Try putting a cursor-up cursor-down movement in a %{...%} block at the
>beginning of your prompt.  That should force the prompt to be no higher
>than the second line without needing to hack any zle widgets.  E.g. in
>3.1.6+ with an 80-column xterm:
>
>PS1="%{"$'\e7\e[1A\e[1B\e[1;1H'%E$'\e[1;72H'"%D{%I:%M:%S}"$'\e8'"%}%m%# "

This doesnt work.. if I use this prompt and then type clear, it clears the
date and leaves the machien name followed by a % on the top line..

For some reason, the up/down isnt forcing it to be on line 1 :( 

I added 2 ups and 2 downs, and it puts it on line 2 tho. dunno.. this is
the behavior i actually want (since my upper right mesg is really 2 rows),
so i don't really care too much.. but if you know why the single isnt
working, let me know :)

-- 
___________________________________________________________________________
Danny Dulai                                           Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/                            nirva@ishiboo.com


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

* Re: clear to end of display
  2000-03-19  7:08         ` Danny Dulai
@ 2000-03-19  7:49           ` Bart Schaefer
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2000-03-19  7:49 UTC (permalink / raw)
  To: Danny Dulai, zsh-users

On Mar 19,  7:08am, Danny Dulai wrote:
} Subject: Re: clear to end of display
}
} >If it's always in the upper right, you might try printing it with a
} >TRAPALRM() function rather than putting it in the prompt.
} 
} That sounded like a good idea until I tried it out. xterms scrolled back
} jump down

You can turn that off with a resource.

XTerm*scrollTtyOutput: false

} and often the time is not there because I'm a obsessive clearer
} of my screen.

That must have something to do with trying to see through it.

} >PS1="%{"$'\e7\e[1A\e[1B\e[1;1H'%E$'\e[1;72H'"%D{%I:%M:%S}"$'\e8'"%}%m%# "
} 
} This doesnt work.. if I use this prompt and then type clear, it clears the
} date and leaves the machien name followed by a % on the top line..

Oops, I transcribed it wrong.  Move the \e7 to after the \e[1B and it
should work.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~2000-03-19  7:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-18  9:18 clear to end of display Danny Dulai
2000-03-18 10:54 ` clear to end of display / clear to end of line Danny Dulai
2000-03-18 18:10   ` clear to end of display Bart Schaefer
2000-03-18 22:55     ` Danny Dulai
2000-03-19  3:50       ` Bart Schaefer
2000-03-19  7:08         ` Danny Dulai
2000-03-19  7:49           ` 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).