mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Add Option to toggle Line Wrap in Console (#1466)
This commit is contained in:
parent
f3a246985a
commit
f45badd026
@ -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));
|
||||
|
@ -60,6 +60,7 @@ private:
|
||||
QSharedPointer<CommandTask> commandTask;
|
||||
|
||||
std::unique_ptr<Ui::ConsoleWidget> ui;
|
||||
QAction *actionWrapLines;
|
||||
QList<QAction *> actions;
|
||||
bool debugOutputEnabled;
|
||||
int maxHistoryEntries;
|
||||
|
Loading…
Reference in New Issue
Block a user