zsh-workers
 help / color / mirror / code / Atom feed
From: Adam Spiers <adam@spiers.net>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Good documentation about literal escape sequences in prompt?
Date: Sat, 11 Mar 2000 23:55:39 +0000	[thread overview]
Message-ID: <20000311235539.A28150@thelonious.new.ox.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.10.10003120123170.22919-100000@verso.st.jyu.fi>; from juhtolv@st.jyu.fi on Sun, Mar 12, 2000 at 01:41:37AM +0200

Juhapekka Tolvanen (juhtolv@st.jyu.fi) wrote:
> 
> %{...%}
>         Include a string as a literal escape sequence. The
>         string within the braces should not change the cursor
>         position. Brace pairs can nest.
> 
> Hey, come on! Do you really think that is enough? Why don't you provide some
> good examples? I know you can do it better!
> 
> For example this does not work:
> 
> PS1="%{\e[1;31m%}$PS1%{\e[1m%}"

That's because \e doesn't mean anything special within double-quotes;
it only gets interpreted as ASCII 27 when used inside $'' quotes, or
from the `print', `echo', or `bindkey' built-ins.  So what you want
is:

PS1=$'%{\e[1;31m%}'"$PS1"$'%{\e[1m%}'

I also made this mistake when first messing around with prompts, so it
looks like the relevant docs could indeed do with a bit of
improvement.  (Would do this myself, but still waiting for someone to
give me the go-ahead on sourceforge, or at least make up-to-date
snapshots available so that I can submit reliable patches.  Anyone
planning to release dev-20 before pws comes back?)

Adam


  reply	other threads:[~2000-03-11 23:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-11 23:41 Juhapekka Tolvanen
2000-03-11 23:55 ` Adam Spiers [this message]
2000-03-12  0:05 ` Bart Schaefer
2000-03-12 17:35   ` Juhapekka Tolvanen
2000-03-12 18:19     ` Oliver Kiddle
2000-03-12 19:34       ` Juhapekka Tolvanen
2000-03-12 18:37     ` Bart Schaefer

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=20000311235539.A28150@thelonious.new.ox.ac.uk \
    --to=adam@spiers.net \
    --cc=zsh-workers@sunsite.auc.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).