-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't clear console prompt when font resizing #271
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, please keep the existing param so calls to eg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow... In d2cc339 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case another PR were to use the bool param, this change would silently result in different behaviour when the two are merged together. Using an enum class would also solve it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree. bitcoin/bitcoin#21684 |
||
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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offtopic: I feel it would be better to use enums, avoiding
/* comments explaining what are we doing */
I've seen here and there.clear(CearMode::KeePrompt)
would be self-docummenting, less error prone. But again, that's offtopic for this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relevant discussion is here bitcoin/bitcoin#21684.