Skip to content

qt: add reset button and console commands for clearing output/history #882

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

waketraindev
Copy link

@waketraindev waketraindev commented Jul 30, 2025

  • Added Reset button with Ctrl+Shift+L shortcut to clear both console output and command history.
  • Added new console commands:
    • clear -> clears console output
    • history-clear -> clears console output and command history
    • history -> prints all stored command history

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 30, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept NACK luke-jr

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change is practical. Clearing the console should remove the visible output, but it shouldn't also clear the command history. In most terminal environments (e.g., bash, zsh, cmd, PowerShell, etc.), using clear or Ctrl+L clears the screen while preserving command history, which remains accessible via the arrow keys. Users often rely on this history to repeat or modify previous commands, and removing it could unintentionally disrupt that workflow. I suggest keeping the command history intact when clearing the console.


Also, just a heads-up: this GUI repository is currently in maintenance mode and primarily focused on bugfixes — new feature additions are unlikely to be considered or prioritized unless they're closely tied to functionality in Bitcoin Core. If you're interested in contributing new features or improvements, I encourage you to take a look at bitcoin-core/gui-qml, which is the new GUI project under active development. Your contributions would be very welcome there.

@waketraindev
Copy link
Author

I don't think this change is practical. Clearing the console should remove the visible output, but it shouldn't also clear the command history. In most terminal environments (e.g., bash, zsh, cmd, PowerShell, etc.), using clear or Ctrl+L clears the screen while preserving command history, which remains accessible via the arrow keys. Users often rely on this history to repeat or modify previous commands, and removing it could unintentionally disrupt that workflow. I suggest keeping the command history intact when clearing the console.

Also, just a heads-up: this GUI repository is currently in maintenance mode and primarily focused on bugfixes — new feature additions are unlikely to be considered or prioritized unless they're closely tied to functionality in Bitcoin Core. If you're interested in contributing new features or improvements, I encourage you to take a look at bitcoin-core/gui-qml, which is the new GUI project under active development. Your contributions would be very welcome there.

Thanks for the feedback. I understand the comparison to typical terminal behavior, but I think the context here is different.

In the RPC console, the command history is never cleared unless you shut down Bitcoin Qt. It stays even after using the "Clear" button, closing the console, or even closing the wallet. This means any sensitive or debug-related commands remain accessible via the arrow keys across sessions. Clearing only the output gives a false impression that the console was fully reset.

This change makes the "Clear" button behave more like a full reset, which helps with privacy and general cleanup during debugging. It also aligns with what some users expect from a GUI console.

I understand the repo is in maintenance mode, but I still think this is a relevant and useful change. If needed, I'm open to submitting it to gui-qml instead.

@waketraindev
Copy link
Author

If there is concern about preserving history by default, a compromise could be to clear command history only when holding Shift while clicking the "Clear" button, similar to how modifier keys are used in other GUIs for alternate actions. But personally, my expectation as a user is that "Clear" fully resets the console, including input history.

@waketraindev waketraindev force-pushed the 2025-07-console-clear-history branch from 9ccce65 to 4dd9a04 Compare August 2, 2025 08:13
@pablomartin4btc
Copy link
Contributor

I'm still not very convinced with this change but let's see what others think. Thank you!

@luke-jr
Copy link
Member

luke-jr commented Aug 5, 2025

Concept NACK, agree we should match expected behaviour here (not clearing command history). Maybe some way can be added, but I'm not sure there's an obvious right way.

@waketraindev waketraindev marked this pull request as draft August 5, 2025 04:01
@waketraindev waketraindev force-pushed the 2025-07-console-clear-history branch from a8720a1 to 3db405b Compare August 5, 2025 10:36
@waketraindev
Copy link
Author

Updated the patch to only clear input when Shift is held; also added Ctrl+Shift+L as a secondary shortcut.

@waketraindev waketraindev force-pushed the 2025-07-console-clear-history branch from 3db405b to 73d2cf9 Compare August 5, 2025 10:40
@waketraindev waketraindev changed the title qt: clear command history when clearing the console qt: add shift key modifier to clear command history when clearing the console Aug 5, 2025
@waketraindev waketraindev marked this pull request as ready for review August 6, 2025 05:25
Copy link
Contributor

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, but I don’t think relying on a hidden keyboard combination (Shift modifier and Ctrl+Shift+L) is a good long-term solution. Most users will never discover it, and without documentation, it risks becoming an obscure feature that only a handful of people know about. It also deviates from common terminal behavior, where clearing the output and clearing history are separate, explicit actions. On top of that, shortcut bindings can be difficult to maintain long-term — they may conflict with other shortcuts, differ across platforms, or get broken by Qt or OS changes.

I think that a more user-friendly and discoverable approach would be to support terminal-style commands in the console, so users can interact in a way they already understand from bash, zsh, cmd, PowerShell, etc. For example:

history               # list cached commands
help history          # show usage info for the history command
history -c            # clear command history
clear                 # clear visible console output only
help clear            # explain clear options (e.g. 'clear history')
clear history         # clear command history

This way, clearing history becomes an intentional action the user explicitly types, and it can be documented alongside other commands in the console’s help output. It’s discoverable, consistent with terminal norms but mainly with the current rpc console behaviour, and extensible if more sub-commands are needed in the future.

@waketraindev waketraindev force-pushed the 2025-07-console-clear-history branch from 73d2cf9 to 8c21bf7 Compare August 12, 2025 14:02
@waketraindev waketraindev marked this pull request as draft August 12, 2025 14:03
@waketraindev waketraindev changed the title qt: add shift key modifier to clear command history when clearing the console qt: add reset button and console commands for clearing output/history Aug 12, 2025
@waketraindev
Copy link
Author

Thanks for the update, but I don’t think relying on a hidden keyboard combination (Shift modifier and Ctrl+Shift+L) is a good long-term solution. Most users will never discover it, and without documentation, it risks becoming an obscure feature that only a handful of people know about. It also deviates from common terminal behavior, where clearing the output and clearing history are separate, explicit actions. On top of that, shortcut bindings can be difficult to maintain long-term — they may conflict with other shortcuts, differ across platforms, or get broken by Qt or OS changes.

I think that a more user-friendly and discoverable approach would be to support terminal-style commands in the console, so users can interact in a way they already understand from bash, zsh, cmd, PowerShell, etc. For example:

history               # list cached commands
help history          # show usage info for the history command
history -c            # clear command history
clear                 # clear visible console output only
help clear            # explain clear options (e.g. 'clear history')
clear history         # clear command history

This way, clearing history becomes an intentional action the user explicitly types, and it can be documented alongside other commands in the console’s help output. It’s discoverable, consistent with terminal norms but mainly with the current rpc console behaviour, and extensible if more sub-commands are needed in the future.

Thanks for the feedback, I agree that discoverability is important, and this is addressed in the latest update.

The patch now adds explicit console commands in addition to the button and shortcut:

  • clear -> clears output
  • history-clear -> clears output and history
  • history -> prints command history

These commands are listed in the help-console output and also documented in the welcome message shown when the console is cleared, so they are easy to discover. This covers the terminal-style interaction you suggested, while still providing a UI button and shortcut for convenience.

The Ctrl+Shift+L shortcut remains as an extra option for users who prefer a quick key combo, but it is no longer the only way to perform the action.

@waketraindev waketraindev marked this pull request as ready for review August 12, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants