-
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
Conversation
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.
Tested ACK dcd7a8c
Naming nit, I'm not sure this applies to the GUI but per doc/developer-notes.md:
- Symbol naming conventions. These are preferred in new code, but are not
required when doing so would need changes to significant pieces of existing
code.- Variable (including function arguments) and namespace names are all lowercase and may use
_
to separate words (snake_case).
- Variable (including function arguments) and namespace names are all lowercase and may use
@jonatack Good point, I was following the style of the surrounding code as well as the Qt Coding Style. @hebasto what do you think? This is a good topic for the Qt Dev Notes |
Concept ACK.
Why not to implement this idea directly: https://github.com/hebasto/gui/commits/pr271-alt ? |
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.
Concept ACK.
I prefer this approach. |
This doesn't appear to be an issue on Windows 10 |
Do you mind elaborating? Testing bitcoin-0.21.1rc1 (not master) on Windows Pro 20H2 (build 19042.928), and clicking on the "A+" or "A-" buttons indeed clears the console prompt. I see this PR as a UX improvement, no? |
Apologies I originally misread, thought this was resizing the window not font. Yes I can replicate this, will test this PR today |
QAbstractButton::clicked signal has the `checked` parameter that is irrelevant to RPCConsole::clear slot parameter.
The default clearHistory=true argument is passed in the RPCConsole ctor only. This is needless, as the history and historyPtr members are initialized properly.
dcd7a8c
to
7962e0d
Compare
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.
ACK 7962e0d
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.
tACK 7962e0d, tested on Debian Sid with Qt 5.15.2
@@ -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); |
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.
Code review ACK 7962e0d I think the PR is named confusedly though and would suggest renaming it: I assumed it was about window resizing too and was really surprised why that would clear anything. |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, please keep the existing param so calls to eg clear(true)
don't silently change behaviour...
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.
I don't follow... In d2cc339 RPCConsole::clear()
has no parameters.
Why keep the existing useless param?
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Using an enum class would also solve it.
Agree. bitcoin/bitcoin#21684
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
PR
Closes #269