Skip to content

Convert first, *then* trim! #86

Closed
SamB opened this Issue Sep 7, 2012 · 1 comment

2 participants

@SamB
SamB commented Sep 7, 2012

In draw_chars(), you first trim the input to the desired width and then transliterate it to the output encoding. This causes things to get out of alignment, try:

$ LANG=C ./tig 2324d6120c5de58f63b32b876bd33e99d7375dbb

to see what I mean.

@jonas jonas added a commit that closed this issue Aug 5, 2013
@jonas iconv: Convert characters before trimming text before rendering
By first trimming and then transliterating, characters which need two
characters to represent would cause the rendered text to get out of
alignment. An example can be seen by running:

	$ LANG=C ./tig 2324d61

Fix the misalignment by reversing the operations so that text is trimmed
after it has been transliterated.

Fixes #86
742ad98
@jonas jonas closed this in 742ad98 Aug 5, 2013
@ashumkin

742ad98

This fix breaks the case, for example, when commit message has non-ASCII characters and LC_ALL set to non-UTF-8 encoding (cp1251 in my case)

len = utf8_length(&string...)
as we can see, string is assumed to be UTF-8 string , but after encoding_iconv() it is not! And len in a result is much less then actual string length.
So, non-UTF-8 string is cut and git log looks corrupted.

P.S. And did't get what @SamB meant

try:
$ LANG=C ./tig 2324d61
to see what I mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.