git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Justin Donnelly <justinrdonnelly@gmail.com>,
	Joakim Petersen <joak-pet@online.no>
Subject: Re: [PATCH try2] completion: prompt: use generic colors
Date: Wed, 1 Mar 2023 14:27:18 -0600	[thread overview]
Message-ID: <CAMP44s23cvp-YWDN7vzsKQCcWoc43PgURq+J6pwtx0rxOpZLBg@mail.gmail.com> (raw)
In-Reply-To: <xmqq4jr4nu3u.fsf@gitster.g>

On Wed, Mar 1, 2023 at 1:34 PM Junio C Hamano <gitster@pobox.com> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:

> > We don't need bash to do this conversion, we can use \001 \002
> > ourselves, and then the prompt command mode is not necessary to display
> > colors.

> Comments from those who use colored prompt and who are familiar with
> the mechansim used to implement this?  As I do not use the feature
> at all and haven't been following it, seeing independent support
> would help the topic.

At least in try1 Justin Donnelly reported success [1].

And you don't need to use the feature to check that this patch
obviously works, it's easy to test. All you need to see the original
problem is a short (as in width) terminal, or a long enough typed line
(I type a lot of d's until surpassing the width).

This prompt should easily show the original problem:

PS1='\w (\e[31mfoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\e[m)
> '

With the marks proposed by the patch, the problem is gone:

PS1='\w (\001\e[31m\002foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo\001\e[m\002)
> '

Of course, in order to test, PROMPT_COMMAND shouldn't override PS1.

Cheers.

[1] https://lore.kernel.org/git/CAGTqyRzZ-cOp1C4f30fGFhjH1hh5U137=77pEHp_bmBzNcmTCw@mail.gmail.com/

-- 
Felipe Contreras

  reply	other threads:[~2023-03-01 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 14:59 [PATCH try2] completion: prompt: use generic colors Felipe Contreras
2023-03-01 19:34 ` Junio C Hamano
2023-03-01 20:27   ` Felipe Contreras [this message]
2023-03-16 14:11     ` Joakim Petersen
2023-03-16 23:00       ` Junio C Hamano
2023-03-16 23:21         ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAMP44s23cvp-YWDN7vzsKQCcWoc43PgURq+J6pwtx0rxOpZLBg@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=joak-pet@online.no \
    --cc=justinrdonnelly@gmail.com \
    /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://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).