diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 34d055e5a53..4fba7ccd04f 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -494,7 +494,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty ui->lineEdit->setMaxLength(16 * 1024 * 1024); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear); + connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); }); connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger); connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller); connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); @@ -776,20 +776,15 @@ void RPCConsole::setFontSize(int newSize) // clear console (reset icon sizes, default stylesheet) and re-add the content float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value(); - clear(false); + clear(/* keep_prompt */ true); ui->messagesWidget->setHtml(str); ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum()); } -void RPCConsole::clear(bool clearHistory) +void RPCConsole::clear(bool keep_prompt) { ui->messagesWidget->clear(); - if(clearHistory) - { - history.clear(); - historyPtr = 0; - } - ui->lineEdit->clear(); + if (!keep_prompt) ui->lineEdit->clear(); ui->lineEdit->setFocus(); // Add smoothly scaled icon images. diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index b9806e40c97..2f8cae6161b 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -99,7 +99,7 @@ private Q_SLOTS: void updateDetailWidget(); public Q_SLOTS: - void clear(bool clearHistory = true); + void clear(bool keep_prompt = false); void fontBigger(); void fontSmaller(); void setFontSize(int newSize);