Re: [PATCH] column: use utf8_strnwidth() to strip out ANSI color escapes
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 14, 2019, 19:33 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1910142132360.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <a165b244-b18d-0434-42c5-bfe28b8bab51@web.de>
Hi René,
On Mon, 14 Oct 2019, René Scharfe wrote:
Show 19 quoted lines
> Am 14.10.19 um 13:13 schrieb Johannes Schindelin: > > > On Sun, 13 Oct 2019, René Scharfe wrote: > > > >> This changes the behavior, though: The old code skips all kinds of > >> Control Sequence Introducer sequences, while utf8_strnwidth() only skips > >> the Select Graphic Rendition kind, i.e. those ending with "m". They are > >> used for specifying color and font attributes like boldness. The only > >> other kind of escape sequence we print in Git is Erase in Line, ending > >> with "K". That's not used for columnar output, so this difference > >> actually doesn't matter here. > > > > Arguably, the "Erase in Line" thing should re-set the width to 0, no? > > But as you say, this is not needed for this patch. > > It doesn't move the cursor, just clears the characters to the right, to > the left or both sides, depending on its parameter. So ignoring it for > width calculation like the old code did would be appropriate -- if we'd > encounter such an escape sequence in text to be shown in columns.
Whoops, you're right. I brainfarted, mistaking it for `\r`... My bad!
Ciao, Dscho