summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-23 08:59:27 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-23 08:59:27 +0200
commitdb108e37793c7f8fc8ba11f00d0561d1f0bd32c0 (patch)
tree5caecb01889fc02c2c8f13345e55ae6cb0cebd67
parentc71281fd44d900032e4a3be19e663993d9b9a0ea (diff)
Fix another text wrapping issue (wrong handling of long unwrappable lines)
-rw-r--r--program/lib/Roundcube/rcube_mime.php4
-rw-r--r--program/steps/mail/func.inc6
-rw-r--r--tests/Framework/Mime.php4
3 files changed, 11 insertions, 3 deletions
diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php
index d413c0a7e..5258af5bf 100644
--- a/program/lib/Roundcube/rcube_mime.php
+++ b/program/lib/Roundcube/rcube_mime.php
@@ -658,6 +658,10 @@ class rcube_mime
$subString = $substr_func($subString, 0, $spacePos, $charset);
$cutLength = $spacePos + 1;
}
+ else if ($cut === false && $breakPos === false) {
+ $subString = $string;
+ $cutLength = null;
+ }
else if ($cut === false) {
$spacePos = $strpos_func($string, ' ', 0, $charset);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 661d3fbbb..ab4b41155 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1516,11 +1516,11 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
/**
* Wrap text to a given number of characters per line
* but respect the mail quotation of replies messages (>).
- * Finally add another quotation level by prpending the lines
+ * Finally add another quotation level by prepending the lines
* with >
*
* @param string Text to wrap
- * @param int The line width
+ * @param int The line width
* @return string The wrapped text
*/
function rcmail_wrap_and_quote($text, $length = 72)
@@ -1536,7 +1536,7 @@ function rcmail_wrap_and_quote($text, $length = 72)
$line = '>' . rtrim($line);
else if (mb_strlen($line) > $max) {
$newline = '';
- foreach(explode("\n", rc_wordwrap($line, $length - 2)) as $l) {
+ foreach (explode("\n", rc_wordwrap($line, $length - 2)) as $l) {
if (strlen($l))
$newline .= '> ' . $l . "\n";
else
diff --git a/tests/Framework/Mime.php b/tests/Framework/Mime.php
index d9f4163ec..4db1856be 100644
--- a/tests/Framework/Mime.php
+++ b/tests/Framework/Mime.php
@@ -193,6 +193,10 @@ class Framework_Mime extends PHPUnit_Framework_TestCase
array("-------\nabc def", 5),
"-------\nabc\ndef",
),
+ array(
+ array("http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/", 70),
+ "http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/",
+ ),
);
foreach ($samples as $sample) {