Re: [PATCH v3 1/2] diff.c: When appropriate, use utf8_strwidth(), part1
From: Johannes Schindelin <hidden>
Date: 2022-09-02 09:39:29
Hi Torsten, On Fri, 2 Sep 2022, tboegi@web.de wrote:
quoted hunk ↗ jump to hunk
diff --git a/diff.c b/diff.c index 974626a621..b5df464de5 100644 --- a/diff.c +++ b/diff.c@@ -2620,7 +2620,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) continue; } fill_print_name(file); - len = strlen(file->print_name); + len = utf8_strwidth(file->print_name);
So this is no longer a length (in bytes) but a width (in columns). In 2/2, a similar change incurs renaming `max_len` to `max_width`. I would prefer for 1/2 and 2/2 to be on the same page here: either they both rename variables that have `len` in their name but are actually about a width (in columns), or neither of the patches rename these variables. Thanks, Dscho
quoted hunk ↗ jump to hunk
if (max_len < len) max_len = len;@@ -2743,7 +2743,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) * "scale" the filename */ len = name_width; - name_len = strlen(name); + name_len = utf8_strwidth(name); if (name_width < name_len) { char *slash; prefix = "..."; --2.34.0