From 02cf4ac440ed9f31213a8071170fed07f70f97ec Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 15:01:39 +0100 Subject: [PATCH] Fix newline rendering in extended display Rich Text is rendered a bit like HTML, where all of the whitespace gets changed into a single space. This is normally not so bad, but with newlines it's annoying. This preserves the newlines from the description. Contributes to issue CURA-8565. --- plugins/Marketplace/PackageModel.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index c4389434e4..a0d68969f1 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -60,6 +60,9 @@ class PackageModel(QObject): url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%._+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.-_+~#?&/=]*)?)") text = re.sub(url_regex, r'\1', text) + # Turn newlines into
so that they get displayed as newlines when rendering as rich text. + text = text.replace("\n", "
") + return text @pyqtProperty(str, constant = True)