File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -918,14 +918,15 @@ sub git_ansi_color {
918
918
919
919
if (grep { / bold/ } @parts ) {
920
920
push (@ansi_part , " 1" );
921
- @parts = grep { !/bold/ } @parts ; # Remove from array
922
921
}
923
922
924
923
if (grep { / reverse/ } @parts ) {
925
924
push (@ansi_part , " 7" );
926
- @parts = grep { !/reverse / } @parts ; # Remove from array
927
925
}
928
926
927
+ # Remove parts that aren't colors
928
+ @parts = grep { exists $colors -> {$_ } || is_numeric($_ ) } @parts ;
929
+
929
930
my $fg = $parts [0] // " " ;
930
931
my $bg = $parts [1] // " " ;
931
932
Original file line number Diff line number Diff line change @@ -121,14 +121,15 @@ sub git_ansi_color {
121
121
122
122
if (grep { / bold/ } @parts ) {
123
123
push (@ansi_part , " 1" );
124
- @parts = grep { !/bold/ } @parts ; # Remove from array
125
124
}
126
125
127
126
if (grep { / reverse/ } @parts ) {
128
127
push (@ansi_part , " 7" );
129
- @parts = grep { !/reverse / } @parts ; # Remove from array
130
128
}
131
129
130
+ # Remove parts that aren't colors
131
+ @parts = grep { exists $colors -> {$_ } || is_numeric($_ ) } @parts ;
132
+
132
133
my $fg = $parts [0] // " " ;
133
134
my $bg = $parts [1] // " " ;
134
135
You can’t perform that action at this time.
0 commit comments