From d5692afd7d46d1153e29fbea822fba416b8a9ad9 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Sun, 2 Dec 2018 15:09:27 +0400 Subject: [PATCH] LogWidget: Preserve spaces and newlines --- Source/Core/DolphinQt/Config/LogWidget.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/Config/LogWidget.cpp b/Source/Core/DolphinQt/Config/LogWidget.cpp index 771acf7289..d8f500fa05 100644 --- a/Source/Core/DolphinQt/Config/LogWidget.cpp +++ b/Source/Core/DolphinQt/Config/LogWidget.cpp @@ -16,6 +16,7 @@ #include #include "Common/FileUtil.h" +#include "Common/StringUtil.h" #include "Core/ConfigManager.h" @@ -210,11 +211,12 @@ void LogWidget::Log(LogTypes::LOG_LEVELS level, const char* text) break; } - m_log_queue.push( - QStringLiteral("%1 %3") - .arg(QString::fromStdString(std::string(text).substr(0, TIMESTAMP_LENGTH)), - QString::fromStdString(color), - QString::fromStdString(std::string(text).substr(TIMESTAMP_LENGTH)).toHtmlEscaped())); + std::string str(text); + StringPopBackIf(&str, '\n'); + m_log_queue.push(QStringLiteral("%1 %3") + .arg(QString::fromStdString(str.substr(0, TIMESTAMP_LENGTH)), + QString::fromStdString(color), + QString::fromStdString(str.substr(TIMESTAMP_LENGTH)).toHtmlEscaped())); } void LogWidget::closeEvent(QCloseEvent*)