Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: since 4.3.4, artifact-appearance at prompt
- X-seq: zsh-users 12188
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: since 4.3.4, artifact-appearance at prompt
- Date: Sun, 4 Nov 2007 14:16:21 -0800
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <071104094803.ZM22628@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071103234335.GB10499@xxxxxxxxx> <071103183038.ZM8388@xxxxxxxxxxxxxxxxxxxxxx> <20071104034810.GA3923@xxxxxxxxx> <20071104070008.15348.qmail@xxxxxxxxxxx> <071104094803.ZM22628@xxxxxxxxxxxxxxxxxxxxxx>
On Sun, Nov 04, 2007 at 09:48:03AM -0800, Bart Schaefer wrote:
> function precmd {
> # An efficient version using termcap multi-right:
> print -nP '%B%S%#%s%b' # Output % or #
> echotc RI $((COLUMNS - 3))
> echo -n ' ' # Output 2 spaces
> }
You should replace the 2-space echo with a print that also outputs a CR:
print -n ' \r'
This makes it less likely that the user's type-ahead after this output
will cause the screen to scroll (and is what the current code does).
Yes, the PROMPT_CR option is going to output a CR too, but it does so
after enough of a delay that I would sometimes see an inverted % on an
empty line if my type-ahead echoed between the PROMPT_SP output and the
PROMPT_CR output.
> PS1=%P{%B%S%#%s%b}$PS1"
>
> Any thoughts from the -workers on that?
It is better to output the %P portion as early as possible in the
post-command-run code, so outputting it as an actual part of the prompt
would probably not be desirable. The PS1 string could get carved up
into early and normal prompt pieces, but it would probably just be
better to have an environment variable that specifies what to output.
e.g.:
PROMPTSP=%{%B%S%}%#%{%s%b%}
However, an alternative to having the user use %{ ... %} would be to
have the user just tell us how wide their string is:
PROMPTSP=1:%B%S%#%s%b
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author