help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH v2] prompt: support generic non-visible regions
Date: Mon, 15 Aug 2022 16:37:12 -0500	[thread overview]
Message-ID: <CAMP44s0F-wz79s+ba3zA0BqOmobPP+jXbrrLNGse1mdwyLu3Kg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Y+RSQn-zVzNDPTJV13ZddnGxnwBC=P5E0RFEm4M+fPnw@mail.gmail.com>

On Sun, Aug 14, 2022 at 8:00 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sun, Aug 14, 2022 at 3:47 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > > How does one embed a literal ctrl-A or ctrl-B in the prompt?
> >
> > What would that achieve?
> Nothing specific, but one can embed any other literal character, so
> why not those?

We could make the code more complex in order to support doing that,
but without knowing the use cases it's unclear how we would test that
it works correctly and it's useful.

Do we want something like "\001foo\002%\001bar%\002"?

> > > I haven't found any readline documentation that explains the use of
> > > "start of header" or "start of text".
> >
> > It's in the code:
> Ah, so "start of header/text" is your phrasing, not theirs.

It's not my phrasing, it's what I've found these characters are called [1].

01 SOH Start of Heading
02 STX Start of Text

> > > I'm also leaning to the opinion that \001 and \002 should only be
> > > recognized when PROMPT_PERCENT is unset.
> >
> > That would defeat the primary purpose of the patch, which is to be
> > able to write prompt helper functions which work in multiple shells.
> In that case I think the patch is incomplete, because it's not keeping
> track of bv->dontcount and will be confused if both \001 and %} are
> used (or %{ and \002).  See lines 602 through 628 of Src/prompt.c
> (line numbers as of commit c5a891a2).

Yes, I've seen that code, but in my view mixing \001 and %{ doesn't
seem to be a useful use case.

Why would somebody do something like this for example:

\001%F{red}foo%f %{$color%}bar%{$reset%}\002

Or this:


I can add code to make %{ and \001 be equivalent, if that's what we
want to do, but how am I supposed to do a reasonable test?


[1] https://www.ascii-code.com/

Felipe Contreras

  reply	other threads:[~2022-08-15 21:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 23:09 Felipe Contreras
2022-08-14 19:57 ` Bart Schaefer
2022-08-14 22:46   ` Felipe Contreras
2022-08-15  1:00     ` Bart Schaefer
2022-08-15 21:37       ` Felipe Contreras [this message]
2022-08-17 22:31         ` Bart Schaefer
2022-08-17 22:48           ` Bart Schaefer
2022-08-22  0:17             ` Felipe Contreras
2022-08-22  0:15           ` Felipe Contreras
2022-08-22  0:11 ` [PATCH v3] " Felipe Contreras

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMP44s0F-wz79s+ba3zA0BqOmobPP+jXbrrLNGse1mdwyLu3Kg@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* 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


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).