Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: PROMPT_SP
- X-seq: zsh-workers 21532
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: PROMPT_SP
- Date: Tue, 26 Jul 2005 14:53:48 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <1050724094938.ZM20755@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1050716160634.ZM31049@xxxxxxxxxxxxxxxxxxxxxxx> <20050716195612.GA11575@xxxxxxxxx> <200507181032.j6IAWB4q022520@xxxxxxxxxxxxxx> <20050718181330.GA19066@xxxxxxxxx> <1050723135554.ZM19813@xxxxxxxxxxxxxxxxxxxxxxx> <20050723165301.GB16571@xxxxxxxxx> <20050723171955.GC16571@xxxxxxxxx> <1050724052757.ZM20380@xxxxxxxxxxxxxxxxxxxxxxx> <20050724061011.GB19554@xxxxxxxxx> <1050724094938.ZM20755@xxxxxxxxxxxxxxxxxxxxxxx>
On Sun, Jul 24, 2005 at 09:49:38AM +0000, Bart Schaefer wrote:
> How about '%B%S%#%s%b' ?
I've been using this suggestion for a couple days, and happened to
notice that sometimes some user-input would echo between the precmd
output and the PROMPT_CR output (causing a confusing wrap with the #
in column 1), so I added a CR to the end of the precmd's output. I
also simplified the code a bit (i.e. no more termcap RI).
..wayne..
--- FAQ.yo 19 Jul 2005 15:18:11 -0000 1.22
+++ FAQ.yo 26 Jul 2005 18:46:36 -0000
@@ -1664,13 +1664,10 @@ sect(How do I prevent the prompt overwri
# Skip defining precmd if the PROMPT_SP option is available.
if ! eval '[[ -o promptsp ]] 2>/dev/null'; then
function precmd {
- # An efficient version using termcap multi-right:
- echo -n ' ' # Output 1 space
- echotc RI $((COLUMNS - 3))
- echo -n ' ' # Output 2 spaces
- # Alternately, try replacing the above 3 lines with this echo
- # that outputs a screen-column-width of spaces:
- #echo -n ${(l:$COLUMNS:::):-}
+ # Output an inverse hash and a bunch spaces. We include
+ # a CR at the end so that any user-input that gets echoed
+ # between this output and the prompt doesn't cause a wrap.
+ print -nP "%B%S#%s%b${(l:$((COLUMNS-1)):::):-}\r"
}
fi
)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author