]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: align per-ref summary report in UTF-8 locales
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 4 Sep 2012 10:39:35 +0000 (17:39 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Sep 2012 19:45:50 +0000 (12:45 -0700)
commit754395d3052fc0d46948b2ff7006b3c6701785c8
tree501893fca3b18e917ba9ff9ca5a807d2353b4d64
parentb52183179bb0a97ea4d91d1248aca303d8e8f892
fetch: align per-ref summary report in UTF-8 locales

fetch does printf("%-*s", width, "foo") where "foo" can be a utf-8
string, but width is in bytes, not columns. For ASCII it's fine as one
byte takes one column. For utf-8, this may result in misaligned ref
summary table.

Introduce gettext_width() function that returns the string length in
columns (currently only supports utf-8 locales). Make the code use
TRANSPORT_SUMMARY(x) where the length is compensated properly in
non-English locales.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
gettext.c
gettext.h
transport.h