Aleksander Machniak
2013-03-18 ec27006ebeef24375dd59c2b952ce98ca8e40084
Fix wrapping of text lines with the same length as specified length limit
2 files modified
11 ■■■■ changed files
program/lib/Roundcube/rcube_mime.php 7 ●●●●● patch | view | raw | blame | history
tests/src/format-flowed.txt 4 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_mime.php
@@ -595,11 +595,12 @@
            while (count($list)) {
                $line   = array_shift($list);
                $l      = mb_strlen($line);
                $newlen = $len + $l + ($len ? 1 : 0);
                $space  = $len ? 1 : 0;
                $newlen = $len + $l + $space;
                if ($newlen <= $width) {
                    $string .= ($len ? ' ' : '').$line;
                    $len += (1 + $l);
                    $string .= ($space ? ' ' : '').$line;
                    $len += ($space + $l);
                }
                else {
                    if ($l > $width) {
tests/src/format-flowed.txt
@@ -1,7 +1,7 @@
I'm replying on this with a very long line which is then wrapped and 
space-stuffed because the draft is saved as format=flowed.
 From what's specified in RFC 2646 some lines need to be space-stuffed to
avoid muning during transport.
 From what's specified in RFC 2646 some lines need to be space-stuffed to avoid
muning during transport.
X