mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
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.
This commit is contained in:
parent
c1f0fb1faf
commit
02cf4ac440
1 changed files with 3 additions and 0 deletions
|
@ -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'<a href="\1">\1</a>', text)
|
||||
|
||||
# Turn newlines into <br> so that they get displayed as newlines when rendering as rich text.
|
||||
text = text.replace("\n", "<br>")
|
||||
|
||||
return text
|
||||
|
||||
@pyqtProperty(str, constant = True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue