diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-08-26 01:17:12 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-08-27 11:42:28 -0700 |
commit | 1452bd64f14efd888fe9c732f603173ba7fa595e (patch) | |
tree | 4d9e48433340d151ee32802fdd52ab634adf9b87 /varint.c | |
parent | b52183179bb0a97ea4d91d1248aca303d8e8f892 (diff) | |
download | git-1452bd64f14efd888fe9c732f603173ba7fa595e.tar.gz git-1452bd64f14efd888fe9c732f603173ba7fa595e.tar.xz |
branch -v: align even when branch names are in UTF-8
Branch names are usually in ASCII so they are not the problem. The
problem most likely comes from "(no branch)" translation, which is
in UTF-8 and makes display-width calculation just wrong. Clarify
this by renaming the field "len" in struct ref_item to "width", as
it stores the display-width and is used to compute the width of the
screen needed to show the names of all the branches, and compute the
display width using utf8_strwidth(), not byte-length with strlen().
Update document to mention the fact that we may want ref names in
UTF-8. Encodings that produce invalid UTF-8 are safe as utf8_strwidth()
falls back to strlen(). The ones that incidentally produce valid UTF-8
sequences will cause misalignment.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'varint.c')
0 files changed, 0 insertions, 0 deletions