From: "Chandra Pratap via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Chandra Pratap <chandrapratap376@gmail.com>,
Chandra Pratap <chandrapratap3519@gmail.com>
Subject: [PATCH] diff.c: use utf8_strwidth() instead of strlen() for display width
Date: Sun, 18 Feb 2024 18:37:23 +0000 [thread overview]
Message-ID: <pull.1668.git.1708281443289.gitgitgadget@gmail.com> (raw)
From: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
---
diff.c: use utf8_strwidth() instead of strlen() for display width
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1668%2FChand-ra%2Fdiff-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1668/Chand-ra/diff-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1668
diff.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/diff.c b/diff.c
index ccfa1fca0d0..02d60af6749 100644
--- a/diff.c
+++ b/diff.c
@@ -2712,13 +2712,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
* making the line longer than the maximum width.
*/
- /*
- * NEEDSWORK: line_prefix is often used for "log --graph" output
- * and contains ANSI-colored string. utf8_strnwidth() should be
- * used to correctly count the display width instead of strlen().
- */
if (options->stat_width == -1)
- width = term_columns() - strlen(line_prefix);
+ width = term_columns() - utf8_strwidth(line_prefix);
else
width = options->stat_width ? options->stat_width : 80;
number_width = decimal_width(max_change) > number_width ?
base-commit: 2996f11c1d11ab68823f0939b6469dedc2b9ab90
--
gitgitgadget
next reply other threads:[~2024-02-18 18:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-18 18:37 Chandra Pratap via GitGitGadget [this message]
2024-02-19 6:23 ` [PATCH] diff.c: use utf8_strwidth() instead of strlen() for display width Patrick Steinhardt
2024-02-19 7:01 ` Junio C Hamano
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=pull.1668.git.1708281443289.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=chandrapratap3519@gmail.com \
--cc=chandrapratap376@gmail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.