From f0992426d9c5af5046c76a2da86183d0c3a40084 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 13 May 2014 13:40:00 -0400
Subject: [PATCH] Bring back the old behaviour where text messages without format=flowed are auto-wrapped. Make it the default in text2html class.

---
 program/steps/mail/func.inc               |    3 ++-
 tests/Framework/Text2Html.php             |    1 +
 program/lib/Roundcube/rcube_text2html.php |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/program/lib/Roundcube/rcube_text2html.php b/program/lib/Roundcube/rcube_text2html.php
index 60016ff..8bcda30 100644
--- a/program/lib/Roundcube/rcube_text2html.php
+++ b/program/lib/Roundcube/rcube_text2html.php
@@ -49,7 +49,7 @@
         // enables format=flowed parser
         'flowed' => false,
         // enables wrapping for non-flowed text
-        'wrap'   => false,
+        'wrap'   => true,
         // line-break tag
         'break'  => "<br>\n",
         // prefix and suffix (wrapper element)
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index ac0d7fc..a1d1a41 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -874,7 +874,8 @@
  */
 function rcmail_plain_body($body, $flowed = false)
 {
-    $text2html = new rcube_text2html($body, false, array('flowed' => $flowed));
+    $options   = array('flowed' => $flowed, 'wrap' => !$flowed);
+    $text2html = new rcube_text2html($body, false, $options);
     $body      = $text2html->get_html();
 
     return $body;
diff --git a/tests/Framework/Text2Html.php b/tests/Framework/Text2Html.php
index 91dabf2..af2604d 100644
--- a/tests/Framework/Text2Html.php
+++ b/tests/Framework/Text2Html.php
@@ -19,6 +19,7 @@
             'break'  => '<br>',
             'links'  => false,
             'flowed' => false,
+            'wrap'   => false,
             'space'  => '_', // replace UTF-8 non-breaking space for simpler testing
         );
 

--
Gitblit v1.9.1