zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: PROMPT_SP
Date: Tue, 26 Jul 2005 14:53:48 -0700	[thread overview]
Message-ID: <20050726215348.GA5990@blorf.net> (raw)
In-Reply-To: <1050724094938.ZM20755@candle.brasslantern.com>

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

On Sun, Jul 24, 2005 at 09:49:38AM +0000, Bart Schaefer wrote:
> How about '%B%S%#%s%b' ?

I've been using this suggestion for a couple days, and happened to
notice that sometimes some user-input would echo between the precmd
output and the PROMPT_CR output (causing a confusing wrap with the #
in column 1), so I added a CR to the end of the precmd's output.  I
also simplified the code a bit (i.e. no more termcap RI).

..wayne..

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

--- FAQ.yo	19 Jul 2005 15:18:11 -0000	1.22
+++ FAQ.yo	26 Jul 2005 18:46:36 -0000
@@ -1664,13 +1664,10 @@ sect(How do I prevent the prompt overwri
     # Skip defining precmd if the PROMPT_SP option is available.
     if ! eval '[[ -o promptsp ]] 2>/dev/null'; then
       function precmd {
-        # An efficient version using termcap multi-right:
-        echo -n ' '       # Output 1 space
-        echotc RI $((COLUMNS - 3))
-        echo -n '  '      # Output 2 spaces
-        # Alternately, try replacing the above 3 lines with this echo
-        # that outputs a screen-column-width of spaces:
-        #echo -n ${(l:$COLUMNS:::):-}
+        # Output an inverse hash 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
   )

      reply	other threads:[~2005-07-26 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-14 18:25 Wayne Davison
2005-07-15 17:55 ` Wayne Davison
2005-07-16 16:06   ` Bart Schaefer
2005-07-16 19:56     ` Wayne Davison
2005-07-18 10:32       ` Peter Stephenson
2005-07-18 18:13         ` Wayne Davison
2005-07-23 13:55           ` Bart Schaefer
2005-07-23 16:53             ` Wayne Davison
2005-07-23 17:19               ` Wayne Davison
2005-07-24  5:27                 ` Bart Schaefer
2005-07-24  6:10                   ` Wayne Davison
2005-07-24  9:49                     ` Bart Schaefer
2005-07-26 21:53                       ` Wayne Davison [this message]

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=20050726215348.GA5990@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=schaefer@brasslantern.com \
    --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).