1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 16:56:43 +02:00
git/contrib/completion
Felipe Contreras 7ee1af8cb8 completion: prompt: use generic colors
When the prompt command mode was introduced in 1bfc51ac81 (Allow
__git_ps1 to be used in PROMPT_COMMAND, 2012-10-10), the assumption was
that it was necessary in order to properly add colors to PS1 in bash,
but this wasn't true.

It's true that the \[ \] markers add the information needed to properly
calculate the width of the prompt, and they have to be added directly to
PS1, a function returning them doesn't work.

But that is because bash coverts the \[ \] markers in PS1 to \001 \002,
which is what readline ultimately needs in order to calculate the width.

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.

This is what functions returning colors are supposed to do [1].

[1] http://mywiki.wooledge.org/BashFAQ/053

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Tested-by: Joakim Petersen <joak-pet@online.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-03-16 15:58:22 -07:00
..
.gitattributes completion: mark bash script as LF-only 2017-05-10 13:32:51 +09:00
git-completion.bash completion: add case-insensitive match of pseudorefs 2022-11-30 09:58:06 +09:00
git-completion.tcsh completion: tcsh: Fix regression by drop of wrapper functions 2021-08-18 13:58:27 -07:00
git-completion.zsh contrib/completion: fix zsh completion regression from 59d85a2a05 2021-06-02 12:49:40 +09:00
git-prompt.sh completion: prompt: use generic colors 2023-03-16 15:58:22 -07:00