]> Dogcows Code - chaz/git-codeowners/commitdiff
embed ansi reset sequence to improve compatibility
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Tue, 12 Nov 2019 02:21:01 +0000 (19:21 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Tue, 12 Nov 2019 02:21:01 +0000 (19:21 -0700)
lib/App/Codeowners.pm

index 113a3a10b4140daec443061731b8868258af9770..c3d01d30ba4151be5ab30e6249bdf7aeb7864d99 100644 (file)
@@ -8,7 +8,7 @@ use strict;
 
 use App::Codeowners::Options;
 use App::Codeowners::Util qw(find_codeowners_in_directory run_git git_ls_files git_toplevel stringf);
-use Color::ANSI::Util qw(ansifg ansi_reset);
+use Color::ANSI::Util 0.03 qw(ansifg);
 use Encode qw(encode);
 use File::Codeowners;
 use Path::Tiny;
@@ -288,11 +288,12 @@ sub _expand_filter_args {
     return (\@filters, $color_override);
 }
 
+sub _ansi_reset { "\033[0m" }
+
 sub _colored {
     my $text = shift;
     my $rgb  = shift or return $text;
 
-    # ansifg honors NO_COLOR already, but ansi_reset does not.
     return $text if $ENV{NO_COLOR};
 
     $rgb =~ s/^(.)(.)(.)$/$1$1$2$2$3$3/;
@@ -301,7 +302,7 @@ sub _colored {
         return $text;
     }
 
-    my ($begin, $end) = (ansifg($rgb), ansi_reset);
+    my ($begin, $end) = (ansifg($rgb), _ansi_reset);
     return "${begin}${text}${end}";
 }
 
This page took 0.0286 seconds and 4 git commands to generate.