diff options
Diffstat (limited to 'MDK')
-rw-r--r-- | MDK/Common/String.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/MDK/Common/String.pm b/MDK/Common/String.pm index 3faa270..5d302a9 100644 --- a/MDK/Common/String.pm +++ b/MDK/Common/String.pm @@ -131,16 +131,18 @@ sub warp_text { my @l; foreach (split "\n", $text) { + my ($beg) = /^(\s*)/; my $t = ''; foreach (split /\s+/, $_) { if (length "$t $_" > $width) { - push @l, $t; + push @l, "$beg$t"; + $beg = ''; $t = $_; } else { - $t = "$t $_"; + $t = $t ? "$t $_" : $_; } } - push @l, $t; + push @l, "$beg$t"; } @l; } |