zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: John Hawkinson <jhawk@alum.mit.edu>
Cc: Bart Schaefer <schaefer@brasslantern.com>, zsh-users@zsh.org
Subject: Re: Why does zsh clear to end-of-screen after prompt?
Date: Sun, 27 Aug 2023 10:34:49 +0200	[thread overview]
Message-ID: <CAN=4vMr+yDCrgLzfK-WqTLjR1hHQfNQfC91qOCcrCPb_Ocra=A@mail.gmail.com> (raw)
In-Reply-To: <ZOlOaISfwY6RFrfH@louder-room.local>

On Sat, Aug 26, 2023 at 3:00 AM John Hawkinson <jhawk@alum.mit.edu> wrote:
>
> In case it wasn't apparent, the use case is I had a small ad hoc
> script that produced ~20 lines of key/value output and sometimes
> the values change and I'd like to keep them in the same position on
> the screen and just overwrite themselves when they change if I
> rerun the script with up-arrow/RET.

An alternative solution is to embed the info in PROMPT. In order to
avoid wasting 20 lines of the TTY real estate on each command, you can
automatically contract the prompt before executing each command. Thus,
if you run `pwd` twice in a row, your TTY might look like this:

    me@box ~ % pwd
    /home/me
    me@box ~ % pwd
    /home/me

    foo=bar
    baz=qux
    me@box ~ % █

In this approach the extra info ("foo=bar", etc.) is always displayed
right above the current prompt. This is basically Transient Prompt
from Powerlevel10k
(https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/transient-prompt.gif)
but with a fatter prompt.

Roman.


  parent reply	other threads:[~2023-08-27  8:35 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 [this message]
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

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='CAN=4vMr+yDCrgLzfK-WqTLjR1hHQfNQfC91qOCcrCPb_Ocra=A@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=jhawk@alum.mit.edu \
    --cc=schaefer@brasslantern.com \
    --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).