Re: [PATCH v2 3/4] utf8: respect string boundaries after skipping ANSI escape sequences
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 18, 2026, 21:49 UTC
- Message-ID
- <xmqqse0x3j57.fsf@gitster.g>
- In-Reply-To
- <20261118-master-v2-3-3f2aaec15d31@gouders.net>
Dirk Gouders <dirk@gouders.net> writes:
Show 5 quoted lines
> - while (skip_ansi &&
> - (skip = display_mode_esc_sequence_len_counted(string,
> - orig + len - string)) != 0)
> - string += skip;
> + if (skip_ansi ) {Drop excess SP after the variable.
> + while ((skip = display_mode_esc_sequence_len_counted(string, > + orig + len - string)) != 0) > + string += skip;
Overlong line. You can (and are encouraged to) omit comparison with zero "!= 0" to lose 5 columns but it still is overly long.
if (skip_ansi) {
while ((skip = display_mode_esc_sequence_len_counted(
string, orig + len - string)))
string += skip;or something, perhaps.
Show 6 quoted lines
> + if (string >= orig + len) > + break; > + } > > glyph_width = utf8_width(&string, NULL); > if (glyph_width > 0)