From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: print color escapes
Date: Thu, 01 Jan 2015 15:02:55 -0800 [thread overview]
Message-ID: <54A5D21F.1090701@eastlink.ca> (raw)
In-Reply-To: <150101132931.ZM27115@torch.brasslantern.com>
On 01/01/2015 01:29 PM, Bart Schaefer wrote:
Excellent, the whole question boils down to this:
> } local lc=$'\e['
>
>
> In that expression, the $'' form of quoting converts \e to ESC, which is
> why the $'' form of quoting exists in the first place (and is different
> from ordinary single quoting). $'' is to avoid having to do something
> more expensive (fork + read output) such as lc="$(echo '\e[')".
That is a POSIX quote? Good to see one in combat, I've only ever had
them drawn to my attention once before. Book lernin' no substitute for
seeing something in action.
> The (V) flag converts ESC to ^[ because that's what most people are used
> to seeing ("visible"). The (q) flag converts to $'\e' because that's
> what people are used to writing (and because "eval ${(q)...}" needs it
> in that format).
Beautiful, these are conventions and practicalities not 'realities'.
> The print and echo commands convert \e to ESC because
> of historical practice.
But terminal will always grab ESC 'hard' will it not? That is to say
that no matter how you dress it up, the terminal always sees it
verbatim. And I'd expect that that convention is now written in stone.
> The bindkey command converts both ^[ and \e to
> ESC for maximum flexibility in writing key bindings. All of this is
> entirely independent of what the terminal does when it sees an ESC.
>
Crystal clear. Too bad there wasn't some way of upvoting an explanation
like that were it to show up on Google eventually, cuz that's as good as
it could be. Questions that were not even asked (but needed to be) were
answered.
BTW too bad in some fonts '' looks almost exactly like ".
next prev parent reply other threads:[~2015-01-01 23:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-01 5:47 Ray Andrews
2015-01-01 6:35 ` Bart Schaefer
2015-01-01 19:24 ` Ray Andrews
2015-01-01 21:29 ` Bart Schaefer
2015-01-01 23:02 ` Ray Andrews [this message]
2015-01-01 23:26 ` Bart Schaefer
2015-01-02 2:30 ` Ray Andrews
2015-01-02 2:45 ` Kurtis Rader
2015-01-02 3:50 ` Ray Andrews
2015-01-02 4:18 ` Bart Schaefer
2015-01-02 17:43 ` Ray Andrews
2015-01-02 1:21 ` Kurtis Rader
2015-01-02 2:39 ` Ray Andrews
2015-01-02 2:58 ` Kurtis Rader
2015-01-02 3:48 ` Ray Andrews
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=54A5D21F.1090701@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@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).