Skip to content

Commit 39e3060

Browse files
committed
Merge bitcoin-core#271: Don't clear console prompt when font resizing
7962e0d qt: Do not clear console prompt when font resizing (Hennadii Stepanov) d2cc339 qt, refactor: Drop redundant history cleaning in RPC console (Hennadii Stepanov) 4f0ae47 qt: Untie irrelevant signal-slot parameters (Hennadii Stepanov) Pull request description: On master, a console resize event will clear the prompt. To fix this, we store the content of the prompt and re-set it upon a resize. This preserves the prompt text throughout resizes. The text will still clear when you click the clear button, as it should. **Master** | Before Resize | After Resize | | ----------------- | ------------ | | ![master-beforeresize](https://user-images.githubusercontent.com/23396902/113553721-2a428d80-95c6-11eb-971b-bb77151bc6d5.png) | ![master-afterresize](https://user-images.githubusercontent.com/23396902/113553769-3d555d80-95c6-11eb-9cdb-9ad1fd7208a9.png) | **PR** | Before Resize | After Resize | | ----------------- | ------------ | | ![pr-beforeresize](https://user-images.githubusercontent.com/23396902/113553885-6f66bf80-95c6-11eb-8317-0975f1ebd444.png) | ![pr-afterresize](https://user-images.githubusercontent.com/23396902/113553906-75f53700-95c6-11eb-9a32-b64d8aba98e5.png) | Closes bitcoin-core#269 ACKs for top commit: laanwj: Code review ACK 7962e0d hebasto: ACK 7962e0d Talkless: tACK 7962e0d, tested on Debian Sid with Qt 5.15.2 Tree-SHA512: a6f19d3f80e2e47725cff5d6e15862b6cb793a65dfcaded15f23bba051088cd3317f068f93290c9b09d0a90f5fcac1c5a4610cc417cc5961ba6d005fe5049ab0
2 parents d2f6d29 + 7962e0d commit 39e3060

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/qt/rpcconsole.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
503503
ui->lineEdit->setMaxLength(16 * 1024 * 1024);
504504
ui->messagesWidget->installEventFilter(this);
505505

506-
connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear);
506+
connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); });
507507
connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger);
508508
connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller);
509509
connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear);
@@ -771,20 +771,15 @@ void RPCConsole::setFontSize(int newSize)
771771

772772
// clear console (reset icon sizes, default stylesheet) and re-add the content
773773
float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value();
774-
clear(false);
774+
clear(/* keep_prompt */ true);
775775
ui->messagesWidget->setHtml(str);
776776
ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
777777
}
778778

779-
void RPCConsole::clear(bool clearHistory)
779+
void RPCConsole::clear(bool keep_prompt)
780780
{
781781
ui->messagesWidget->clear();
782-
if(clearHistory)
783-
{
784-
history.clear();
785-
historyPtr = 0;
786-
}
787-
ui->lineEdit->clear();
782+
if (!keep_prompt) ui->lineEdit->clear();
788783
ui->lineEdit->setFocus();
789784

790785
// Add smoothly scaled icon images.

src/qt/rpcconsole.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private Q_SLOTS:
9999
void updateDetailWidget();
100100

101101
public Q_SLOTS:
102-
void clear(bool clearHistory = true);
102+
void clear(bool keep_prompt = false);
103103
void fontBigger();
104104
void fontSmaller();
105105
void setFontSize(int newSize);

0 commit comments

Comments
 (0)