* Bug or Feature? Clear line before prompt.
@ 2005-10-14 6:16 Com MN PG P E B Consultant 3
2005-10-14 6:37 ` Steve Borho
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Com MN PG P E B Consultant 3 @ 2005-10-14 6:16 UTC (permalink / raw)
To: zsh-users Mailinglist
Before zsh issues the PS1 prompt, it clears the line. This has the
effect that
I don't see the last line of the previous command, unless it is
terminated
by a newline. Example:
perl -e 'print "hello"'
does not show the output "hello", because it is erased immediately by
the shell, but
perl -e 'print "hello\n"
shows, because the output is terminated by \n.
My setting of PS1 is: %B%~%b>
Is there a way to tell zsh not to erase the line before writing the
prompt?
Ronald
--
Ronald Fischer <mn-pg-p-e-b-consultant-3.com@siemens.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug or Feature? Clear line before prompt.
2005-10-14 6:16 Bug or Feature? Clear line before prompt Com MN PG P E B Consultant 3
@ 2005-10-14 6:37 ` Steve Borho
2005-10-14 9:25 ` Wayne Davison
2005-10-14 9:26 ` DervishD
2 siblings, 0 replies; 4+ messages in thread
From: Steve Borho @ 2005-10-14 6:37 UTC (permalink / raw)
To: Com MN PG P E B Consultant 3; +Cc: zsh-users Mailinglist
On Fri, 2005-10-14 at 08:16 +0200, Com MN PG P E B Consultant 3 wrote:
> Before zsh issues the PS1 prompt, it clears the line. This has the
> effect that
> I don't see the last line of the previous command, unless it is
> terminated
> by a newline. Example:
>
> perl -e 'print "hello"'
% echo -n foo
% unsetopt prompt_cr
% echo -n foo
foo%
Note that turning this option off can do some bad things to the command
line editor and many of the fancier prompts.
--
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug or Feature? Clear line before prompt.
2005-10-14 6:16 Bug or Feature? Clear line before prompt Com MN PG P E B Consultant 3
2005-10-14 6:37 ` Steve Borho
@ 2005-10-14 9:25 ` Wayne Davison
2005-10-14 9:26 ` DervishD
2 siblings, 0 replies; 4+ messages in thread
From: Wayne Davison @ 2005-10-14 9:25 UTC (permalink / raw)
To: Com MN PG P E B Consultant 3; +Cc: zsh-users Mailinglist
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..
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug or Feature? Clear line before prompt.
2005-10-14 6:16 Bug or Feature? Clear line before prompt Com MN PG P E B Consultant 3
2005-10-14 6:37 ` Steve Borho
2005-10-14 9:25 ` Wayne Davison
@ 2005-10-14 9:26 ` DervishD
2 siblings, 0 replies; 4+ messages in thread
From: DervishD @ 2005-10-14 9:26 UTC (permalink / raw)
To: Com MN PG P E B Consultant 3; +Cc: zsh-users Mailinglist
Hi Ronald :)
* Com MN PG P E B Consultant 3 <mn-pg-p-e-b-consultant-3.com@siemens.com> dixit:
> I don't see the last line of the previous command, unless it is
> terminated
> by a newline. Example:
>
> perl -e 'print "hello"'
>
> does not show the output "hello", because it is erased immediately by
> the shell, but
>
> perl -e 'print "hello\n"
>
> shows, because the output is terminated by \n.
>
> My setting of PS1 is: %B%~%b>
>
> Is there a way to tell zsh not to erase the line before writing the
> prompt?
You can always "unsetopt prompt_cr", but I find this one much
more useful:
# After you've set your PS1
PS1=$'\n'"$PS1"
This prints a newline before the prompt itself. You can achieve
this with precmd, too, you can make it print a newline if there is
text on the current line (I think you can know that in Linux using
/dev/vcs), or if the cursor is in the last column, etc. For me adding
a newline character just before my PS1 is enough.
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-14 9:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-14 6:16 Bug or Feature? Clear line before prompt Com MN PG P E B Consultant 3
2005-10-14 6:37 ` Steve Borho
2005-10-14 9:25 ` Wayne Davison
2005-10-14 9:26 ` DervishD
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).