Permalink
Browse files

Fixes in uncolor

  • Loading branch information...
1 parent ea16708 commit 69a346f3c6061912cbe60d5feb6a1818276ea48a @tadzik committed Jul 26, 2010
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/Term/ANSIColor.pm
View
6 lib/Term/ANSIColor.pm
@@ -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(' ');

0 comments on commit 69a346f

Please sign in to comment.