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

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

Previous: René Scharfe
Message 4 of 4 in “column: use utf8_strnwidth() to strip out ANSI color escapes”
  1. column: use utf8_strnwidth() to strip out ANSI color escapesRené Scharfe, Oct 13, 2019
  2. Johannes SchindelinOct 14, 2019
  3. René ScharfeOct 14, 2019
  4. Johannes SchindelinOct 14, 2019

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.