[Rt-commit] rt branch, 4.4/wrap-column-count, created. rt-4.4.4-6-ge36c9fecd

Blaine Motsinger blaine at bestpractical.com
Fri Mar 15 18:21:48 EDT 2019


The branch, 4.4/wrap-column-count has been created
        at  e36c9fecd90ca98609db809bb0bfb92f35a3ae0a (commit)

- Log -----------------------------------------------------------------
commit e36c9fecd90ca98609db809bb0bfb92f35a3ae0a
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. The wrap column count can
    now be configured through RT_SiteConfig.pm with the QuoteWrapWidth
    variable.
    
        Set( $QuoteWrapWidth, 70 );

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..8fc84b46f 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 configurable through the QuoteWrapWidth
+config variable and defaults to 70 characters.
 
 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'),
         @_
     );
 
@@ -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