Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why does zsh clear to end-of-screen after prompt?



On Fri, Aug 25, 2023 at 5:59 PM John Hawkinson <jhawk@xxxxxxxxxxxx> wrote:
>
> 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?

Maybe you're actually an audience for https://github.com/psprint/n-commodore ...

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

If it's OK for the output to be at the top of the screen and the
prompt toward the bottom:

preexec() { print -n $'\e[H' }

You can make this conditional, e.g., only do it if repeating the same
command again, or make a widget that sets the desired starting
position of the output so this only happens if you use that widget
instead of accept-line, etc.




Messages sorted by: Reverse Date, Date, Thread, Author