Re: [PATCH v3 0/6] use the pager in 'add -p'
- From
- Dragan Simic <dsimic@manjaro.org>
- Date
- Jun 4, 2024, 17:41 UTC
- Message-ID
- <c9888ea1e70d892e9f21db70977e0631@manjaro.org>
- In-Reply-To
- <xmqqcyoy6mnl.fsf@gitster.g>
On 2024-06-03 18:01, Junio C Hamano wrote:
Show 8 quoted lines
> Dragan Simic <dsimic@manjaro.org> writes: > >> Thus, when piping to a custom program, the escape codes that >> perform the coloring should be stripped. > > I tend to agree that if we do not give a way to toggle between > "with" and "without" color when piping to a program, it is safer to > make the default uncolored.
Good point. The default behavior or "|xyz" should be to strip the coloring escape sequences, because we don't know is "xyz" capable of handling those escape sequences properly, and to keep the coloring with "||xyz" or whatever we come up with for our equivalent "--color=always", so to speak.
Show 10 quoted lines
> The user's configured pager is expected to deal with colors just > fine (or the user has globally configured colors to be off). As we > are capable of telling if the user is asking to spawn the default > pager (by not giving a custom command or by clearing the previous > custom command given in the same session) or a custom one, it should > be easily doable to give colored version to the configured pager and > uncolored version to a custom/one-shot command. Unlike the existing > support for (e)dit command, we do not read back from what the > command does using the hunk and present it again to the user, it > should be a relatively easy and safe thing to do.
Exactly.