zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: zsh-workers@sunsite.dk
Subject: Re: promptcr workaround
Date: Tue, 1 Mar 2005 09:06:28 -0800	[thread overview]
Message-ID: <20050301170628.GC32736@blorf.net> (raw)
In-Reply-To: <20050301164119.GA32736@blorf.net>

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

What do folks think of including this idea in the FAQ?  I've attached a
patch that does this.

..wayne..

[-- Attachment #2: faq.patch --]
[-- Type: text/plain, Size: 1930 bytes --]

--- Etc/FAQ.yo	17 Jan 2005 10:49:51 -0000	1.15
+++ Etc/FAQ.yo	1 Mar 2005 17:03:56 -0000
@@ -1667,15 +1667,25 @@ sect(How do I prevent the prompt overwri
     % 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.  A better
+  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:::):-}
+    }
+  )
+  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.  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:[~2005-03-01 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01  8:17 Karl Chen
2005-03-01 16:41 ` Wayne Davison
2005-03-01 17:06   ` Wayne Davison [this message]
2005-03-01 19:50   ` Karl Chen
2005-03-01 17:39 ` Bart Schaefer
2005-03-01 18:20   ` Danek Duvall
2005-03-01 18:50     ` Wayne Davison
2005-03-02 20:21   ` Clint Adams

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=20050301170628.GC32736@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=zsh-workers@sunsite.dk \
    /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).