mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-27 00:53:55 -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 "../utility/logger.h"
|
||||||
|
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
||||||
|
|
@ -44,7 +45,12 @@ void DlgViewLog::loadInitialLogBuffer()
|
||||||
|
|
||||||
void DlgViewLog::logEntryAdded(QString message)
|
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 */)
|
void DlgViewLog::closeEvent(QCloseEvent * /* event */)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue