File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -543,16 +543,23 @@ sub strip_leading_indicators {
543
543
if ($manually_color_lines ) {
544
544
if (defined ($5 ) && $5 eq " +" ) {
545
545
my $add_line_color = get_config_color(" add_line" );
546
- $line = $add_line_color . $line . $reset_color ;
546
+ $line = $add_line_color . insert_reset_at_line_end( $line ) ;
547
547
} elsif (defined ($5 ) && $5 eq " -" ) {
548
548
my $remove_line_color = get_config_color(" remove_line" );
549
- $line = $remove_line_color . $line . $reset_color ;
549
+ $line = $remove_line_color . insert_reset_at_line_end( $line ) ;
550
550
}
551
551
}
552
552
553
553
return $line ;
554
554
}
555
555
556
+ # Insert the color reset code at end of line, but before any newlines
557
+ sub insert_reset_at_line_end {
558
+ my $line = shift ();
559
+ $line =~ s / ^(.*)([\n\r ]+)?$/ ${1}${reset_color} ${2}/ ;
560
+ return $line ;
561
+ }
562
+
556
563
# Count the number of a given char in a string
557
564
sub char_count {
558
565
my ($needle ,$str ) = @_ ;
You can’t perform that action at this time.
0 commit comments