From: Junio C Hamano <gitster@pobox.com>
To: LorenzoPegorari <lorenzo.pegorari2002@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [GSoC PATCH v2 0/2] diff: handle UTF-8 chars in prefix when calculating diffstat width
Date: Fri, 27 Feb 2026 10:04:57 -0800 [thread overview]
Message-ID: <xmqq5x7irrjq.fsf@gitster.g> (raw)
In-Reply-To: <cover.1772136203.git.lorenzo.pegorari2002@gmail.com> (LorenzoPegorari's message of "Fri, 27 Feb 2026 17:01:07 +0100")
LorenzoPegorari <lorenzo.pegorari2002@gmail.com> writes:
> This patch aims to fix a bug where the calculation of the diffstat width
> incorrectly uses the strlen() of line_prefix instead of its actual
> display width.
>
> This patch addresses the NEEDSWORK item added by ce8529b2 (diff: leave
> NEEDWORK notes in show_stats() function, 2022-10-21).
>
> V2 DIFF:
> * Changed references from "ANSI char" to "UTF-8 char"
Is that correct? I thought these references are mostly about the
ANSI color escape sequences that are used to paint strings in color
e.g.,
printf "This is shown in \033[31mRED\033[0m color\012"
uses "\033[31m" (use RED as the foreground color) and "\033[0m"
(reset all styles and colors). The problem the NEEDSWORK comment
talks about is that the code uses strlen() but these two sequences
in the above example are 0-width as far as the terminal display
width computation is concerned. And that is why we want to use
utf8_strnwidth() with SKIP_ANSI bit on.
> diff.c | 12 ++++--------
> t/b | 0
> t/t4052-stat-output.sh | 30 ++++++++++++++++++++++++++++++
> 3 files changed, 34 insertions(+), 8 deletions(-)
> create mode 100644 t/b
I doubt you meant to add a new file there ;-)
next prev parent reply other threads:[~2026-02-27 18:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 1:09 [GSoC PATCH 0/2] diff: handle ANSI chars in prefix when calculating diffstat width LorenzoPegorari
2026-02-24 1:11 ` [GSoC PATCH 1/2] " LorenzoPegorari
2026-02-24 1:20 ` [GSoC PATCH 2/2] t4074: add test for diffstat width when prefix contains ANSI chars LorenzoPegorari
2026-02-24 5:43 ` Junio C Hamano
2026-02-25 2:18 ` Lorenzo Pegorari
2026-02-24 5:17 ` [GSoC PATCH 0/2] diff: handle ANSI chars in prefix when calculating diffstat width Junio C Hamano
2026-02-27 16:01 ` [GSoC PATCH v2 0/2] diff: handle UTF-8 " LorenzoPegorari
2026-02-27 16:04 ` [GSoC PATCH v2 1/2] " LorenzoPegorari
2026-02-27 16:08 ` [GSoC PATCH v2 2/2] t4052: add test for diffstat width when prefix contains UTF-8 chars LorenzoPegorari
2026-02-27 18:08 ` Junio C Hamano
2026-02-27 18:04 ` Junio C Hamano [this message]
2026-02-27 21:43 ` [GSoC PATCH v3 0/2] diff: handle ANSI escape codes in prefix when calculating diffstat width LorenzoPegorari
2026-02-27 21:45 ` [GSoC PATCH v3 1/2] " LorenzoPegorari
2026-02-27 21:48 ` [GSoC PATCH v3 2/2] t4052: test for diffstat width when prefix contains ANSI escape codes LorenzoPegorari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5x7irrjq.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=lorenzo.pegorari2002@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox