From: Dragan Simic Date: Tue, 04 Jun 2024 17:41:13 GMT Subject: Re: [PATCH v3 0/6] use the pager in 'add -p' Message-ID: In-Reply-To: On 2024-06-03 18:01, Junio C Hamano wrote: > Dragan Simic 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. > 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.