Fix text wrapping issue with long unwrappable lines (#1489371)

pull/136/head
Aleksander Machniak 11 years ago
parent d1abd8e339
commit 0f15219a93

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Fix text wrapping issue with long unwrappable lines (#1489371)
- Add spellchecker backend for the After the Deadline service - Add spellchecker backend for the After the Deadline service
- Replace markdown-style [1] link indexes in plain text email bodies - Replace markdown-style [1] link indexes in plain text email bodies
- Fixed issues where HTML comments inside style tag would hang Internet Explorer - Fixed issues where HTML comments inside style tag would hang Internet Explorer

@ -637,7 +637,8 @@ class rcube_mime
if ($nextChar === ' ' || $nextChar === $separator) { if ($nextChar === ' ' || $nextChar === $separator) {
$afterNextChar = mb_substr($string, $width + 1, 1); $afterNextChar = mb_substr($string, $width + 1, 1);
if ($afterNextChar === false) { // Note: mb_substr() does never return False
if ($afterNextChar === false || $afterNextChar === '') {
$subString .= $nextChar; $subString .= $nextChar;
} }
@ -650,24 +651,23 @@ class rcube_mime
$subString = mb_substr($subString, 0, $spacePos); $subString = mb_substr($subString, 0, $spacePos);
$cutLength = $spacePos + 1; $cutLength = $spacePos + 1;
} }
else if ($cut === false && $breakPos === false) {
$subString = $string;
$cutLength = null;
}
else if ($cut === false) { else if ($cut === false) {
$spacePos = mb_strpos($string, ' ', 0); $spacePos = mb_strpos($string, ' ', 0);
if ($spacePos !== false && $spacePos < $breakPos) { if ($spacePos !== false && ($breakPos === false || $spacePos < $breakPos)) {
$subString = mb_substr($string, 0, $spacePos); $subString = mb_substr($string, 0, $spacePos);
$cutLength = $spacePos + 1; $cutLength = $spacePos + 1;
} }
else if ($breakPos === false) {
$subString = $string;
$cutLength = null;
}
else { else {
$subString = mb_substr($string, 0, $breakPos); $subString = mb_substr($string, 0, $breakPos);
$cutLength = $breakPos + 1; $cutLength = $breakPos + 1;
} }
} }
else { else {
$subString = mb_substr($subString, 0, $width);
$cutLength = $width; $cutLength = $width;
} }
} }

@ -197,6 +197,10 @@ class Framework_Mime extends PHPUnit_Framework_TestCase
array("http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/", 70), 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/", "http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/",
), ),
array(
array("this-is-just-some-blabla-to-make-this-more-than-seventy-five-characters-in-a-row -- this line should be wrapped", 20, "\n"),
"this-is-just-some-blabla-to-make-this-more-than-seventy-five-characters-in-a-row\n-- this line should\nbe wrapped",
),
); );
foreach ($samples as $sample) { foreach ($samples as $sample) {

Loading…
Cancel
Save