Re: [PATCH try2] completion: prompt: use generic colors
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Mar 1, 2023, 20:27 UTC
- Message-ID
- <CAMP44s23cvp-YWDN7vzsKQCcWoc43PgURq+J6pwtx0rxOpZLBg@mail.gmail.com>
- 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