Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug or Feature? Clear line before prompt.
- X-seq: zsh-users 9496
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Com MN PG P E B Consultant 3 <mn-pg-p-e-b-consultant-3.com@xxxxxxxxxxx>
- Subject: Re: Bug or Feature? Clear line before prompt.
- Date: Fri, 14 Oct 2005 02:25:28 -0700
- Cc: zsh-users Mailinglist <zsh-users@xxxxxxxxxx>
- In-reply-to: <6F0CB04509C11D46A54232E852E390AC44B902@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <6F0CB04509C11D46A54232E852E390AC44B902@xxxxxxxxxxxxxxxxxxxxxxxxxx>
On Fri, Oct 14, 2005 at 08:16:36AM +0200, Com MN PG P E B Consultant 3 wrote:
> Is there a way to tell zsh not to erase the line before writing the
> prompt?
This is taken from the FAQ:
A better solution than disabling PROMPT_CR (for most terminals) is adding
a simpler version of the PROMPT_SP (new in 4.3.0) functionality to an
older zsh using a custom precmd function, like this one:
# Skip defining precmd if the PROMPT_SP option is available.
if ! eval '[[ -o promptsp ]] 2>/dev/null'; then
function precmd {
# Output an inverse char 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
That precmd function will only bump the screen down to a new line if there
was output on the prompt line, otherwise the extra chars get removed by
the PROMPT_CR action. Although this typically looks fine it may result
in the spaces preceding the prompt being included when you select a line
of preserved text with the mouse.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author