mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
Merge branch 'jk/colors' into maint
"diff-highlight" (in contrib/) used to show byte-by-byte differences, which meant that multi-byte characters can be chopped in the middle. It learned to pay attention to character boundaries (assuming the UTF-8 payload). * jk/colors: diff-highlight: do not split multibyte characters
This commit is contained in:
commit
d544696afa
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use 5.008;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
@ -164,8 +165,12 @@ sub highlight_pair {
|
||||||
|
|
||||||
sub split_line {
|
sub split_line {
|
||||||
local $_ = shift;
|
local $_ = shift;
|
||||||
return map { /$COLOR/ ? $_ : (split //) }
|
return utf8::decode($_) ?
|
||||||
split /($COLOR*)/;
|
map { utf8::encode($_); $_ }
|
||||||
|
map { /$COLOR/ ? $_ : (split //) }
|
||||||
|
split /($COLOR+)/ :
|
||||||
|
map { /$COLOR/ ? $_ : (split //) }
|
||||||
|
split /($COLOR+)/;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub highlight_line {
|
sub highlight_line {
|
||||||
|
|
Loading…
Reference in a new issue