From: Bart Schaefer <schaefer@brasslantern.com>
To: John Hawkinson <jhawk@alum.mit.edu>
Cc: zsh-users@zsh.org
Subject: Re: Why does zsh clear to end-of-screen after prompt?
Date: Sat, 9 Sep 2023 16:23:48 -0700 [thread overview]
Message-ID: <CAH+w=7ba2eATAi3enewDJfwr5NVo0PPb0EtD8b_DKzeFFxXa4g@mail.gmail.com> (raw)
In-Reply-To: <ZOlOaISfwY6RFrfH@louder-room.local>
On Fri, Aug 25, 2023 at 5:59 PM John Hawkinson <jhawk@alum.mit.edu> wrote:
>
> Bart Schaefer <schaefer@brasslantern.com> wrote on Fri, 25 Aug 2023
> at 20:18:01 EDT in <CAH+w=7ZQaJgvk=wLX5mVEC4XR3AP1kxZU+t6O88PZFAZ6p6w9Q@mail.gmail.com>:
>
> > 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.
prev parent reply other threads:[~2023-09-09 23:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 19:52 John Hawkinson
2023-08-26 0:18 ` Bart Schaefer
2023-08-26 0:59 ` John Hawkinson
2023-08-26 1:39 ` Bart Schaefer
2023-08-27 8:34 ` Roman Perepelitsa
2023-08-27 15:36 ` Grant Taylor
2023-08-27 16:02 ` Roman Perepelitsa
2023-08-27 18:55 ` Grant Taylor
2023-09-09 23:23 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7ba2eATAi3enewDJfwr5NVo0PPb0EtD8b_DKzeFFxXa4g@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=jhawk@alum.mit.edu \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).