zsh-workers
 help / color / mirror / code / Atom feed
From: "Jérémie Roquet" <arkanosis@gmail.com>
To: Jeremy Shoup <jeremy.shoup@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Old zsh change
Date: Tue, 5 Mar 2013 18:32:59 +0100	[thread overview]
Message-ID: <CAFOazAO9KCZUr+QKfpJbKzrZQ4AnWNmKMfDsEMAbWKZOUjbn=g@mail.gmail.com> (raw)
In-Reply-To: <CACEuSLdcc08Oojfo-tUrSsgs6impLLcazLoEVT3o-BWN+ViH=w@mail.gmail.com>

[-- 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?)

  reply	other threads:[~2013-03-05 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 17:24 Jeremy Shoup
2013-03-05 17:32 ` Jérémie Roquet [this message]
2013-03-10 22:44 ` Wayne Davison

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='CAFOazAO9KCZUr+QKfpJbKzrZQ4AnWNmKMfDsEMAbWKZOUjbn=g@mail.gmail.com' \
    --to=arkanosis@gmail.com \
    --cc=jeremy.shoup@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).