[Rt-commit] rt branch, 4.4/wrap-column-count, created. rt-4.4.4-6-g23d0cf6f6
Blaine Motsinger
blaine at bestpractical.com
Fri Mar 22 19:50:39 EDT 2019
The branch, 4.4/wrap-column-count has been created
at 23d0cf6f6dcba541eec32cff45c57e0a7b3c4a30 (commit)
- Log -----------------------------------------------------------------
commit 23d0cf6f6dcba541eec32cff45c57e0a7b3c4a30
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Fri Mar 15 13:13:32 2019 -0500
Added configurable option for wrap column count
This change moves the default value for wrap column count from the
RT::Transaction module to RT_Config.pm.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 54e5949e7..fa8ef0358 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2334,6 +2334,15 @@ It defaults to on. Set this to 0 to disable it.
Set($QuoteFolding, 1);
+=item C<$QuoteWrapWidth>
+
+C<$QuoteWrapWidth> controls the number of columns to use when wrapping
+quoted text within transactions.
+
+=cut
+
+Set($QuoteWrapWidth, 70);
+
=back
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index b027ef664..914fe51ca 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -332,8 +332,9 @@ If this transaction has attached mime objects, returns the body of the first
textual part (as defined in RT::I18N::IsTextualContentType). Otherwise,
returns the message "This transaction appears to have no content".
-Takes a paramhash. If the $args{'Quote'} parameter is set, wraps this message
-at $args{'Wrap'}. $args{'Wrap'} defaults to 70.
+Takes a paramhash. If the $args{'Quote'} parameter is set, wraps this message
+at $args{'Wrap'}. $args{'Wrap'} is set from the $QuoteWrapWidth
+config variable.
If $args{'Type'} is set to C<text/html>, this will return an HTML
part of the message, if available. Otherwise it looks for a text/plain
@@ -348,7 +349,7 @@ sub Content {
my %args = (
Type => $PreferredContentType || '',
Quote => 0,
- Wrap => 70,
+ Wrap => RT->Config->Get('QuoteWrapWidth') || 70,
@_
);
@@ -442,7 +443,9 @@ sub ApplyQuoteWrap {
$max = length if length > $max;
}
- if ( $max > 76 ) {
+ # the addition of 6 here accounts for the extra characters added when quoting
+ # previously quoted text.
+ if ( $max > $args{cols} + 6 ) {
require Text::Quoted;
require Text::Wrapper;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list