This commit is contained in:
Martin Rotter 2020-11-05 08:11:42 +01:00
parent 5c586f060a
commit ca86d66bd2
1 changed files with 4 additions and 1 deletions

View File

@ -77,8 +77,11 @@ void Message::sanitize() {
// Sanitize title.
m_title = m_title
// Remove non-breaking spaces.
.replace(QRegularExpression(QSL("[\\u202F\\u00A0 ]")), QSL(" "))
// Shrink consecutive whitespaces.
.replace(QRegularExpression(QSL("[\\s\\u202F\\u00A0]{2,}")), QSL(" "))
.replace(QRegularExpression(QSL("[\\s]{2,}")), QSL(" "))
// Remove all newlines and leading white space.
.remove(QRegularExpression(QSL("([\\n\\r])|(^\\s)")));