fix for long lines

master
const an teen 2021-12-04 14:21:25 -05:00
parent a78db0a110
commit 51541270f5
2 changed files with 14 additions and 1 deletions

View File

@ -249,6 +249,7 @@ body {
.main_payload__chat_mail {
flex: 89%;
word-wrap: break-word;
}
.main_payload__error {

View File

@ -612,7 +612,19 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath)
QString text {buffer};
text.remove(QRegularExpression("^\\[.*\\]\\s"));
text.replace(' ', " "); // for long spaces (code examples, etc)
if (text.size() < 30) {
text.replace(' ', "&nbsp;"); // for long spaces (code examples, etc)
} else {
while (QRegularExpression("[^\\s]{50,10000}.*").match(text).hasMatch()) {
int pos = text.indexOf(QRegularExpression("[^\\s]{50,10000}.*"));
if (pos == -1) {
consoleLog("Bug! HttpServer.cpp while (QRegularExpression(\"[^\\s]{50,10000}.*\").match(text).hasMatch())");
break;
}
text.insert(pos+25, ' ');
}
}
if (text.isEmpty()) continue;