diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-08-25 11:22:29 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-08-25 11:22:29 +0000 |
commit | 19e121ea99827329d083efc75ed00b15e995dfd8 (patch) | |
tree | 63e7fdb6af479ec6771eb65da630c7c879ec3eb8 /MDK | |
parent | 39bed9aba4ff78ff5f9f98704beaa261c1c7507c (diff) | |
download | perl-MDK-Common-19e121ea99827329d083efc75ed00b15e995dfd8.tar perl-MDK-Common-19e121ea99827329d083efc75ed00b15e995dfd8.tar.gz perl-MDK-Common-19e121ea99827329d083efc75ed00b15e995dfd8.tar.bz2 perl-MDK-Common-19e121ea99827329d083efc75ed00b15e995dfd8.tar.xz perl-MDK-Common-19e121ea99827329d083efc75ed00b15e995dfd8.zip |
fix warp_string
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; } |