From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26927 invoked from network); 1 Mar 2005 17:06:49 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Mar 2005 17:06:49 -0000 Received: (qmail 1343 invoked from network); 1 Mar 2005 17:06:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Mar 2005 17:06:43 -0000 Received: (qmail 21161 invoked by alias); 1 Mar 2005 17:06:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20900 Received: (qmail 21137 invoked from network); 1 Mar 2005 17:06:34 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Mar 2005 17:06:34 -0000 Received: (qmail 717 invoked from network); 1 Mar 2005 17:06:34 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO binome.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 1 Mar 2005 17:06:30 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id E8285249B; Tue, 1 Mar 2005 09:06:28 -0800 (PST) Date: Tue, 1 Mar 2005 09:06:28 -0800 From: Wayne Davison To: zsh-workers@sunsite.dk Subject: Re: promptcr workaround Message-ID: <20050301170628.GC32736@blorf.net> References: <20050301164119.GA32736@blorf.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: <20050301164119.GA32736@blorf.net> User-Agent: Mutt/1.5.6+20040907i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline What do folks think of including this idea in the FAQ? I've attached a patch that does this. ..wayne.. --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="faq.patch" --- 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?) --wRRV7LY7NUeQGEoC--