diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index 02462356..3cd10d46 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -88,6 +88,13 @@ ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) : connect(actionClear, SIGNAL(triggered(bool)), ui->outputTextEdit, SLOT(clear())); actions.append(actionClear); + actionWrapLines = new QAction(tr("Wrap Lines"), ui->outputTextEdit); + actionWrapLines->setCheckable(true); + connect(actionWrapLines, &QAction::triggered, this, [this] (bool checked) { + ui->outputTextEdit->setLineWrapMode(checked ? QPlainTextEdit::WidgetWidth: QPlainTextEdit::NoWrap); + }); + actions.append(actionWrapLines); + // Completion QCompleter *completer = new QCompleter(radareArgs, this); completer->setMaxVisibleItems(20); @@ -96,6 +103,8 @@ ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) : ui->inputLineEdit->setCompleter(completer); + ui->outputTextEdit->setLineWrapMode(QPlainTextEdit::WidgetWidth); + // Set console output context menu ui->outputTextEdit->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->outputTextEdit, SIGNAL(customContextMenuRequested(const QPoint &)), @@ -213,6 +222,8 @@ void ConsoleWidget::on_execButton_clicked() void ConsoleWidget::showCustomContextMenu(const QPoint &pt) { + actionWrapLines->setChecked(ui->outputTextEdit->lineWrapMode() == QPlainTextEdit::WidgetWidth); + QMenu *menu = new QMenu(ui->outputTextEdit); menu->addActions(actions); menu->exec(ui->outputTextEdit->mapToGlobal(pt)); diff --git a/src/widgets/ConsoleWidget.h b/src/widgets/ConsoleWidget.h index 853f36c7..baa19bcb 100644 --- a/src/widgets/ConsoleWidget.h +++ b/src/widgets/ConsoleWidget.h @@ -60,6 +60,7 @@ private: QSharedPointer commandTask; std::unique_ptr ui; + QAction *actionWrapLines; QList actions; bool debugOutputEnabled; int maxHistoryEntries;