[PATCH] [Kmail2] [Bug 373040] Stop line wrapping for long links.

Stéphane Clérambault stephane at clerambault.fr
Thu Jan 13 01:09:40 GMT 2022


---
 src/composer-ng/richtextcomposer.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/composer-ng/richtextcomposer.cpp b/src/composer-ng/richtextcomposer.cpp
index d9e79c4..568da8e 100644
--- a/src/composer-ng/richtextcomposer.cpp
+++ b/src/composer-ng/richtextcomposer.cpp
@@ -77,6 +77,17 @@ RichTextComposer::RichTextComposer(QWidget *parent)
                 d->undoHtmlVersion.clear();
             }
         }
+
+        if (d->mode == RichTextComposer::Plain) {
+            QTextBlockFormat nonBreakableLinkFormat;
+            nonBreakableLinkFormat.setNonBreakableLines(true);
+            QTextCursor cursor = textCursor();
+            const QLatin1String httpPattern = QLatin1String("http");
+
+            if (cursor.block().text().startsWith(httpPattern))
+                if (cursor.blockFormat().nonBreakableLines() == false)
+                    cursor.setBlockFormat(nonBreakableLinkFormat);
+        }
     });
 }
 
-- 
2.34.1



More information about the kde-pim mailing list