git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Joakim Petersen
Message 3 of 6 in “completion: prompt: use generic colors”
  1. completion: prompt: use generic colorsFelipe Contreras, Feb 28, 2023
  2. Junio C HamanoMar 1, 2023
  3. Felipe ContrerasMar 1, 2023
  4. Joakim PetersenMar 16, 2023
  5. Junio C HamanoMar 16, 2023
  6. Felipe ContrerasMar 16, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.