From: Wayne Davison <wayned@users.sourceforge.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@sunsite.dk
Subject: Re: since 4.3.4, artifact-appearance at prompt
Date: Sun, 4 Nov 2007 14:16:21 -0800 [thread overview]
Message-ID: <20071104221621.GB28076@blorf.net> (raw)
In-Reply-To: <071104094803.ZM22628@torch.brasslantern.com>
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..
next prev parent reply other threads:[~2007-11-04 22:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-03 23:43 Russell Hoover
2007-11-04 1:30 ` Bart Schaefer
2007-11-04 3:48 ` Russell Hoover
2007-11-04 7:00 ` Atom Smasher
2007-11-04 17:48 ` Bart Schaefer
2007-11-04 22:16 ` Wayne Davison [this message]
2007-11-04 23:48 ` Bart Schaefer
2007-11-05 6:01 ` Wayne Davison
2007-11-05 15:16 ` Bart Schaefer
2007-11-05 11:28 ` Oliver Kiddle
2007-11-05 15:35 ` Bart Schaefer
2007-11-04 22:18 ` Wayne Davison
2007-11-04 14:51 ` Benjamin Andresen
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=20071104221621.GB28076@blorf.net \
--to=wayned@users.sourceforge.net \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/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).