mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Strip color escape codes in Debug Log window (#5915)
This commit is contained in:
parent
69107f79e3
commit
bd8306bd33
1 changed files with 7 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include "../utility/logger.h"
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <QRegularExpression>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
||||
|
|
@ -44,7 +45,12 @@ void DlgViewLog::loadInitialLogBuffer()
|
|||
|
||||
void DlgViewLog::logEntryAdded(QString message)
|
||||
{
|
||||
logArea->appendPlainText(message);
|
||||
static auto colorEscapeCodePattern = QRegularExpression("\033\\[\\d+m");
|
||||
|
||||
QString sanitizedMessage = message;
|
||||
sanitizedMessage.replace(colorEscapeCodePattern, "");
|
||||
|
||||
logArea->appendPlainText(sanitizedMessage);
|
||||
}
|
||||
|
||||
void DlgViewLog::closeEvent(QCloseEvent * /* event */)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue