]> git.ipfire.org Git - thirdparty/git.git/commit
column: use utf8_strnwidth() to strip out ANSI color escapes
authorRené Scharfe <l.s.r@web.de>
Sun, 13 Oct 2019 12:49:50 +0000 (14:49 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Oct 2019 01:54:15 +0000 (10:54 +0900)
commita81e42d23588188c49f9b6e519f99a734a5aacb9
treed7a551b322d1bb6ced8344b0627edc8f801f2643
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
column: use utf8_strnwidth() to strip out ANSI color escapes

Make use of utf8_strnwidth()'s feature to skip ANSI escape sequences
instead of open-coding it.  This shortens the code and makes it more
consistent.

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.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
column.c