From 647f20cb95345f22ab52254de596abe0668fedbe Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Mon, 19 Dec 2022 18:50:58 +0900 Subject: [PATCH] bug fix for log --- ui/mainwindow.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 963dfb0e8..29c0f983c 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -1271,15 +1271,24 @@ inline void FastAppendTextDocument(const QString &message, QTextDocument *doc) { } void MainWindow::show_log_impl(const QString &log) { - auto log2 = log.trimmed(); - if (log2.isEmpty()) return; + auto lines = SplitLines(log.trimmed()); + if (lines.isEmpty()) return; + QStringList newLines; auto log_ignore = NekoRay::dataStore->log_ignore; - for (const auto &str: log_ignore) { - if (log2.contains(str)) return; + for (const auto &line: lines) { + bool showThisLine = true; + for (const auto &str: log_ignore) { + if (line.contains(str)) { + showThisLine = false; + break; + } + } + if (showThisLine) newLines << line; } + if (newLines.isEmpty()) return; - FastAppendTextDocument(log2, qvLogDocument); + FastAppendTextDocument(newLines.join("\n"), qvLogDocument); // qvLogDocument->setPlainText(qvLogDocument->toPlainText() + log); // From https://gist.github.com/jemyzhang/7130092 auto maxLines = 200;