Skip to content

Commit

Permalink
[Str.indent] ignore empty lines for outdenting
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Dec 1, 2012
1 parent 0bfba1b commit 8444e8d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/Str.pm
Expand Up @@ -927,13 +927,13 @@ my class Str does Stringy {
!! 1;
$indent-size += $width;
$char => $width;
});
}).eager;

{ :$indent-size, :@indent-chars, :$rest };
{ :$indent-size, :@indent-chars, :rest(~$rest) };
});

# Figure out the amount * should outdent by, we also use this for warnings
my $common-prefix = [min] @lines.map({ $_<indent-size> });
my $common-prefix = min @lines.grep({ .<rest> ~~ /\S/}).map({ $_<indent-size> });

# Set the actual outdent amount here
my Int $outdent = $steps ~~ Whatever ?? $common-prefix
Expand Down

0 comments on commit 8444e8d

Please sign in to comment.