Thread (6 messages) 6 messages, 3 authors, 2023-03-16

Re: [PATCH try2] completion: prompt: use generic colors

From: Felipe Contreras <hidden>
Date: 2023-03-01 20:27:33

On Wed, Mar 1, 2023 at 1:34 PM Junio C Hamano [off-list ref] wrote:
Felipe Contreras [off-list ref] writes:
quoted
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/ (local)

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help