Skip to content

Commit

Permalink
Fixes in uncolor
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed Jul 26, 2010
1 parent ea16708 commit 69a346f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Term/ANSIColor.pm
Expand Up @@ -63,14 +63,12 @@ sub colorvalid (*@a) is export {

sub uncolor (Str $what) is export {
my @res;
# removing leading '\e[' and trailing 'm'
my $str = $what.substr(2).chop;
my @list = $str.split(';');
my @list = $what.comb(/\d+/);
for @list -> $elem {
if %attrs.reverse.exists($elem) {
@res.push(%attrs.reverse{$elem})
} else {
die("No such sequence: {'\e' ~ $elem ~ 'm'}")
die("No such sequence: {'\e[' ~ $elem ~ 'm'}")
}
}
return @res.join(' ');
Expand Down

0 comments on commit 69a346f

Please sign in to comment.