From a0c34e772f0c6dff3a6500cfd03353c6cad2b2f2 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 11 Oct 2013 18:46:42 +0000
Subject: [PATCH] Better detection of headline width

---
 include/html2text.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/html2text.php b/include/html2text.php
index 944c62f19..ba1e1389d 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -361,7 +361,8 @@ class HtmlHeadlineElement extends HtmlBlockElement {
             default:
                 return $headline;
         }
-        $headline .= "\n" . str_repeat($line, strpos($headline, "\n", 1) - 1) . "\n";
+        $length = max(array_map('strlen', explode("\n", $headline)));
+        $headline .= "\n" . str_repeat($line, $length) . "\n";
         return $headline;
     }
 }
-- 
GitLab