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 {
918918
919919 if (grep { / bold/ } @parts ) {
920920 push (@ansi_part , " 1" );
921- @parts = grep { !/bold/ } @parts ; # Remove from array
922921 }
923922
924923 if (grep { / reverse/ } @parts ) {
925924 push (@ansi_part , " 7" );
926- @parts = grep { !/reverse / } @parts ; # Remove from array
927925 }
928926
927+ # Remove parts that aren't colors
928+ @parts = grep { exists $colors -> {$_ } || is_numeric($_ ) } @parts ;
929+
929930 my $fg = $parts [0] // " " ;
930931 my $bg = $parts [1] // " " ;
931932
Original file line number Diff line number Diff line change @@ -121,14 +121,15 @@ sub git_ansi_color {
121121
122122 if (grep { / bold/ } @parts ) {
123123 push (@ansi_part , " 1" );
124- @parts = grep { !/bold/ } @parts ; # Remove from array
125124 }
126125
127126 if (grep { / reverse/ } @parts ) {
128127 push (@ansi_part , " 7" );
129- @parts = grep { !/reverse / } @parts ; # Remove from array
130128 }
131129
130+ # Remove parts that aren't colors
131+ @parts = grep { exists $colors -> {$_ } || is_numeric($_ ) } @parts ;
132+
132133 my $fg = $parts [0] // " " ;
133134 my $bg = $parts [1] // " " ;
134135
You can’t perform that action at this time.
0 commit comments