diff --git a/src/common/CommandTask.cpp b/src/common/CommandTask.cpp index c027cab13..0366aaf2b 100644 --- a/src/common/CommandTask.cpp +++ b/src/common/CommandTask.cpp @@ -2,8 +2,7 @@ #include "CommandTask.h" #include "TempConfig.h" -CommandTask::CommandTask(const QString &cmd, ColorMode colorMode, bool outFormatHtml) - : cmd(cmd), colorMode(colorMode), outFormatHtml(outFormatHtml) +CommandTask::CommandTask(const QString &cmd, ColorMode colorMode) : cmd(cmd), colorMode(colorMode) { } @@ -12,8 +11,5 @@ void CommandTask::runTask() TempConfig tempConfig; tempConfig.set("scr.color", colorMode); auto res = Core()->cmdTask(cmd); - if (outFormatHtml) { - res = CutterCore::ansiEscapeToHtml(res); - } emit finished(res); } diff --git a/src/common/CommandTask.h b/src/common/CommandTask.h index 24a74a5ba..15136699e 100644 --- a/src/common/CommandTask.h +++ b/src/common/CommandTask.h @@ -17,8 +17,7 @@ class CUTTER_EXPORT CommandTask : public AsyncTask MODE_16M = COLOR_MODE_16M }; - CommandTask(const QString &cmd, ColorMode colorMode = ColorMode::DISABLED, - bool outFormatHtml = false); + CommandTask(const QString &cmd, ColorMode colorMode = ColorMode::DISABLED); QString getTitle() override { return tr("Running Command"); } @@ -31,7 +30,6 @@ class CUTTER_EXPORT CommandTask : public AsyncTask private: QString cmd; ColorMode colorMode; - bool outFormatHtml; }; #endif // COMMANDTASK_H diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index bd9983c33..f9f8570c8 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -4451,11 +4451,13 @@ bool CutterCore::setColor(const QString &key, const QString &color) QString CutterCore::ansiEscapeToHtml(const QString &text) { int len; - char *html = rz_cons_html_filter(text.toUtf8().constData(), &len); + QString r = text; + r.replace("\t", " "); + char *html = rz_cons_html_filter(r.toUtf8().constData(), &len); if (!html) { return {}; } - QString r = QString::fromUtf8(html, len); + r = QString::fromUtf8(html, len); rz_mem_free(html); return r; } diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index 63f0ab650..cf1b6aaab 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -228,11 +228,11 @@ void ConsoleWidget::executeCommand(const QString &command) addOutput(cmd_line); RVA oldOffset = Core()->getOffset(); - commandTask = QSharedPointer( - new CommandTask(command, CommandTask::ColorMode::MODE_256, false)); + commandTask = + QSharedPointer(new CommandTask(command, CommandTask::ColorMode::MODE_16M)); connect(commandTask.data(), &CommandTask::finished, this, [this, cmd_line, command, oldOffset](const QString &result) { - ui->outputTextEdit->appendPlainText(result); + ui->outputTextEdit->appendHtml(CutterCore::ansiEscapeToHtml(result)); scrollOutputToEnd(); historyAdd(command); commandTask.clear();