Fixed cmd_output newlines not being displayed (fixes #92) (#95)

ConfirmationDialog uses Qt::RichText for the body text, which causes line
breaks to be collapsed since the text is rendered as HTML. This can be fixed by
using Qt::convertFromPlainText with Qt::WhiteSpacePre.
This commit is contained in:
Patrick Gaskin 2020-11-15 12:16:46 -05:00 committed by GitHub
parent 437e248c47
commit a25a821e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include <QScreen> #include <QScreen>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QTextDocument>
#include <QUrl> #include <QUrl>
#include <QVariant> #include <QVariant>
#include <QWidget> #include <QWidget>
@ -853,5 +854,5 @@ NM_ACTION_(cmd_output) {
return quiet return quiet
? nm_action_result_silent() ? nm_action_result_silent()
: nm_action_result_msg("%s", qPrintable(out)); : nm_action_result_msg("%s", qPrintable(Qt::convertFromPlainText(out, Qt::WhiteSpacePre)));
} }

View file

@ -44,6 +44,7 @@ static QAction* (*AbstractNickelMenuController_createAction)(void*, QMenu* menu,
// ConfirmationDialogFactory::showOKDialog shows an dialog box with an OK // ConfirmationDialogFactory::showOKDialog shows an dialog box with an OK
// button, and should only be called from the main thread (or a signal handler). // button, and should only be called from the main thread (or a signal handler).
// Note that ConfirmationDialog uses Qt::RichText for the body.
static void (*ConfirmationDialogFactory_showOKDialog)(QString const& title, QString const& body); static void (*ConfirmationDialogFactory_showOKDialog)(QString const& title, QString const& body);
MainWindowController *(*MainWindowController_sharedInstance)(); MainWindowController *(*MainWindowController_sharedInstance)();