Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why does zsh clear to end-of-screen after prompt?
- X-seq: zsh-users 29224
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: John Hawkinson <jhawk@xxxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Why does zsh clear to end-of-screen after prompt?
- Date: Sat, 9 Sep 2023 16:23:48 -0700
- Archived-at: <https://zsh.org/users/29224>
- In-reply-to: <ZOlOaISfwY6RFrfH@louder-room.local>
- List-id: <zsh-users.zsh.org>
- References: <ZOkGi5f6hPuk_1-b@louder-room.local> <CAH+w=7ZQaJgvk=wLX5mVEC4XR3AP1kxZU+t6O88PZFAZ6p6w9Q@mail.gmail.com> <ZOlOaISfwY6RFrfH@louder-room.local>
On Fri, Aug 25, 2023 at 5:59 PM John Hawkinson <jhawk@xxxxxxxxxxxx> wrote:
>
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote on Fri, 25 Aug 2023
> at 20:18:01 EDT in <CAH+w=7ZQaJgvk=wLX5mVEC4XR3AP1kxZU+t6O88PZFAZ6p6w9Q@xxxxxxxxxxxxxx>:
>
> > This happens because ZLE is a mult-line editor and also because
> > completion uses the space under the editor area to display lists etc.
> > If the screen were not cleared, text being edited could mingle with
> > the screen contents already present.
>
> Ugh. I suppose it would be too much to ask that it not do this in the (for me) 90+% case where neither completion nor multi-line editing have been used?
How about this, then? I'd completely forgotten about "zle -T" ...
no_clr_eos () {
emulate -L zsh
if [[ $1 == cd ]]
then
REPLY=""
elif [[ -n $2 ]]
then
REPLY=$(echotc "$@")
else
REPLY=$termcap[$1]
fi
}
zmodload zsh/termcap
precmd() { zle -T tc no_clr_eos }
zle-line-init () { zle -Tr tc }
zle -N zle-line-init
No promises on how this affects performance. Optionally add:
zle-line-finish() {
CURSOR=$#BUFFER
zle -R
echotc cd
}
zle -N zle-line-finish
Conversion to add-zsh-hook / add-zle-hook-widget left as an exercise.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author