diff options
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r-- | Bugzilla/Util.pm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index aad2c5672..4d702f02e 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -38,7 +38,7 @@ use base qw(Exporter); i_am_cgi get_netaddr correct_urlbase lsearch diff_arrays diff_strings - trim wrap_comment find_wrap_point + trim wrap_hard wrap_comment find_wrap_point format_time format_time_decimal validate_date validate_time file_mod_time is_7bit_clean @@ -339,6 +339,17 @@ sub find_wrap_point { return $wrappoint; } +sub wrap_hard { + my ($string, $columns) = @_; + local $Text::Wrap::columns = $columns; + local $Text::Wrap::unexpand = 0; + local $Text::Wrap::huge = 'wrap'; + + my $wrapped = wrap('', '', $string); + chomp($wrapped); + return $wrapped; +} + sub format_time { my ($date, $format) = @_; @@ -739,6 +750,11 @@ compared to the old one. Returns a list, where the first entry is a scalar containing removed items, and the second entry is a scalar containing added items. +=item C<wrap_hard($string, $size)> + +Wraps a string, so that a line is I<never> longer than C<$size>. +Returns the string, wrapped. + =item C<wrap_comment($comment)> Takes a bug comment, and wraps it to the appropriate length. The length is |