public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* 'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width
@ 2014-01-25  3:34 Yuri
  2014-01-25  4:02 ` Duy Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Yuri @ 2014-01-25  3:34 UTC (permalink / raw)
  To: Git Mailing List

The fragment of 'git diff' output looks like this:
- <translation>Ошибка: адрес %1 содержит запрещенные символы. 
Пожалуйста, перепро�
+ <translation>Ошибка: адрес %1 содержит запрещённые символы. 
Пожалуйста, перепро�

Two issues here:
1. Cyrilic text in utf8 got truncated not at utf8 boundary, causing this 
garbage symbol in the end
2. Truncation is done at somewhat ~70% of the actual screen width. git 
could go all the way to the whole screen with, but it didn't. Shrinking 
terminal width causes the output truncation limit to shrink in the same 
proportion. So some bad decision about truncation size is made somewhere 
in 'git diff' command.

Suggested behavior:
1. git should respect utf8, and in case of truncation it should add … 
symbol.
2. truncation algorithm should read current terminal width and truncate 
at width-1 length to allow for the above-mentioned symbol

Yuri

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width
  2014-01-25  3:34 'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width Yuri
@ 2014-01-25  4:02 ` Duy Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Duy Nguyen @ 2014-01-25  4:02 UTC (permalink / raw)
  To: Yuri; +Cc: Git Mailing List

On Sat, Jan 25, 2014 at 10:34 AM, Yuri <yuri@rawbw•com> wrote:
> The fragment of 'git diff' output looks like this:
> - <translation>Ошибка: адрес %1 содержит запрещенные символы. Пожалуйста,
> перепро�
> + <translation>Ошибка: адрес %1 содержит запрещённые символы. Пожалуйста,
> перепро�
>
> Two issues here:
> 1. Cyrilic text in utf8 got truncated not at utf8 boundary, causing this
> garbage symbol in the end
> 2. Truncation is done at somewhat ~70% of the actual screen width. git could
> go all the way to the whole screen with, but it didn't. Shrinking terminal
> width causes the output truncation limit to shrink in the same proportion.
> So some bad decision about truncation size is made somewhere in 'git diff'
> command.
>
> Suggested behavior:
> 1. git should respect utf8, and in case of truncation it should add …
> symbol.
> 2. truncation algorithm should read current terminal width and truncate at
> width-1 length to allow for the above-mentioned symbol

I don't think git diff truncates its output (it does truncate @@
lines, but not the real diff). Perhaps your pager did that?
-- 
Duy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-25  4:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-25  3:34 'git diff' command doesn't honor utf8 symbol boundaries, and doesn't use actual terminal width Yuri
2014-01-25  4:02 ` Duy Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox