* Re: Old zsh change
2013-03-05 17:24 Old zsh change Jeremy Shoup
@ 2013-03-05 17:32 ` Jérémie Roquet
2013-03-10 22:44 ` Wayne Davison
1 sibling, 0 replies; 3+ messages in thread
From: Jérémie Roquet @ 2013-03-05 17:32 UTC (permalink / raw)
To: Jeremy Shoup; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
Hi,
2013/3/5 Jeremy Shoup <jeremy.shoup@gmail.com>:
> I've recently upgraded my zsh from 4.2.0 to 4.3.10 (by upgrading some
> systems from Redhat ES 4 to 6). I've noticed a behaviour change that I
> think is related to a very old change to zsh, change 20900 (2005-03-03)
> according to the ChangeLog. I wanted to have a look at what that change was
> to determine the best way for me to deal with it, but the ChangeLog does
> not indicate which source file(s) were affected by that change. I was
> wondering if you could tell me what files were changed?
20900 is a FAQ change, see attached patch.
Best regards,
--
Jérémie
[-- Attachment #2: zsh-20900.patch --]
[-- Type: application/octet-stream, Size: 2838 bytes --]
commit a50c752448392ce503e37c968f8cf183923dcd39
Author: Peter Stephenson <pws@users.sourceforge.net>
Date: Thu Mar 3 10:29:22 2005 +0000
20900, adapted: promptcr workaround
diff --git a/ChangeLog b/ChangeLog
index cdc7712..2655737 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-03 Peter Stephenson <pws@csr.com>
+
+ * from Wayne, adapted: 20900: another way of preventing
+ text without a newline from being overwritten by the prompt.
+ (Originally suggested by Karl Chen in 20896.)
+
2005-03-02 Clint Adams <clint@zsh.org>
* 20906: Completion/Unix/Command/_make: patch from
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index e9798c9..0f2fc19 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -1667,15 +1667,31 @@ sect(How do I prevent the prompt overwriting output when there is no newline?)
% echo -n foo
%
)
- and the tt(foo) has been overwritten by the prompt tt(%). The answer is
- simple: put tt(unsetopt promptcr) in your tt(.zshrc). The option \
- tt(PROMPT_CR),
- to print a carriage return before a new prompt, is set by default because
- a prompt at the right hand side (mytt($RPROMPT), mytt($RPS1)) will not appear
- in the right place, and multi-line editing will be confused about the line
- position, unless the line starts in the left hand column. Apart from
- tt(PROMPT_CR), you can force this to happen by putting a newline in the
- prompt (see question link(3.13)(313) for that).
+ and the tt(foo) has been overwritten by the prompt tt(%). The reason this
+ happens is that the option tt(PROMPT_CR) is enabled by default, and it
+ outputs a carriage return before the prompt in order to ensure that the
+ line editor knows what column it is in (this is needed to position the
+ right-side prompt correctly (mytt($RPROMPT), mytt($RPS1)) and to avoid screen
+ corruption when performing line editing). If you add tt(unsetopt promptcr)
+ to your tt(.zshrc), you will see any partial output, but your screen may
+ look weird until you press return or refresh the screen.
+
+ Another solution for many terminals is to define a precmd function that
+ outputs a screen-width of spaces, like this:
+ verb(
+ function precmd {
+ echo -n ${(l:$COLUMNS:::):-}
+ }
+ )
+ (Explanation: an empty parameter expansion is padded out to the number of
+ columns on the screen.) That precmd function will only bump the screen
+ down to a new line if there was output on the prompt line, otherwise the
+ extra spaces get removed by the tt(PROMPT_CR) action. Although this
+ typically looks fine it may result in the preceding spaces being included
+ when you select a line of text with the mouse.
+
+ One final alternative is to put a newline in your prompt -- see question
+ link(3.13)(313) for that.
sect(What's wrong with cut and paste on my xterm?)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Old zsh change
2013-03-05 17:24 Old zsh change Jeremy Shoup
2013-03-05 17:32 ` Jérémie Roquet
@ 2013-03-10 22:44 ` Wayne Davison
1 sibling, 0 replies; 3+ messages in thread
From: Wayne Davison @ 2013-03-10 22:44 UTC (permalink / raw)
To: Jeremy Shoup; +Cc: Zsh list
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
On Tue, Mar 5, 2013 at 9:24 AM, Jeremy Shoup <jeremy.shoup@gmail.com> wrote:
> I've recently upgraded my zsh from 4.2.0 to 4.3.10 (by upgrading
> some systems from Redhat ES 4 to 6). I've noticed a behaviour change that
> I think is related to a very old change to zsh, change 20900
> (2005-03-03) according to the ChangeLog.
It sounds like you may be referring to the PROMPT_SP option, which the FAQ
entry for question 3.23 intros as follows:
[Prompt overwriting of output] is normally limited to zsh versions prior to
4.3.0 due to the advent of the PROMPT_SP option (which is enabled by
default, and eliminates this problem for most terminals).
If you don't like the way prompt_sp works, that FAQ entry also details a
work-alike function that can be run from precmd, which you could customize
and use instead.
..wayne..
^ permalink raw reply [flat|nested] 3+ messages in thread