Add console commands for clearing output and history #882

pull waketraindev wants to merge 1 commits into bitcoin-core:master from waketraindev:2025-07-console-clear-history changing 2 files +62 −6
  1. waketraindev commented at 11:41 am on July 30, 2025: contributor

    Adds new console commands for clearing the screen and managing command history in the GUI RPC console.

    Introduces four new commands:

    • clear - clears the console output area.
    • clear-all - clears both output and command history.
    • history - lists stored command history.
    • history-clear - clears command history only.

    Provides explicit, privacy-orientd ways to clear console history and output without altering default behavior. Useful in shared or long-running sessions.

  2. DrahtBot commented at 11:41 am on July 30, 2025: contributor

    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.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #909 (Comment out sensitive console commands in history to prevent re-execution by waketraindev)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. pablomartin4btc commented at 5:01 am on August 2, 2025: contributor

    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.

  4. waketraindev commented at 8:00 am on August 2, 2025: contributor

    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.

  5. waketraindev commented at 8:11 am on August 2, 2025: contributor
    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.
  6. waketraindev force-pushed on Aug 2, 2025
  7. pablomartin4btc commented at 1:08 pm on August 2, 2025: contributor
    I’m still not very convinced with this change but let’s see what others think. Thank you!
  8. luke-jr commented at 2:20 am on August 5, 2025: member
    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.
  9. waketraindev marked this as a draft on Aug 5, 2025
  10. waketraindev force-pushed on Aug 5, 2025
  11. waketraindev commented at 10:39 am on August 5, 2025: contributor
    Updated the patch to only clear input when Shift is held; also added Ctrl+Shift+L as a secondary shortcut.
  12. waketraindev force-pushed on Aug 5, 2025
  13. waketraindev renamed this:
    qt: clear command history when clearing the console
    qt: add shift key modifier to clear command history when clearing the console
    on Aug 5, 2025
  14. waketraindev marked this as ready for review on Aug 6, 2025
  15. pablomartin4btc commented at 4:40 pm on August 11, 2025: contributor

    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:

    0history               # list cached commands
    1help history          # show usage info for the history command
    2history -c            # clear command history
    3clear                 # clear visible console output only
    4help clear            # explain clear options (e.g. 'clear history')
    5clear 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.

  16. waketraindev force-pushed on Aug 12, 2025
  17. waketraindev marked this as a draft on Aug 12, 2025
  18. waketraindev renamed this:
    qt: add shift key modifier to clear command history when clearing the console
    qt: add reset button and console commands for clearing output/history
    on Aug 12, 2025
  19. waketraindev commented at 2:11 pm on August 12, 2025: contributor

    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:

    0history               # list cached commands
    1help history          # show usage info for the history command
    2history -c            # clear command history
    3clear                 # clear visible console output only
    4help clear            # explain clear options (e.g. 'clear history')
    5clear 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.

  20. waketraindev marked this as ready for review on Aug 12, 2025
  21. hebasto renamed this:
    qt: add reset button and console commands for clearing output/history
    Add reset button and console commands for clearing output/history
    on Sep 6, 2025
  22. waketraindev closed this on Sep 24, 2025

  23. waketraindev reopened this on Sep 25, 2025

  24. pablomartin4btc commented at 9:43 pm on September 25, 2025: contributor

    Sorry I haven’t had the chance to check the PR earlier.

    Replacing this line: Use up and down arrows to navigate history, and Ctrl+L to clear screen. By: Use up and down arrows to navigate history, Ctrl+L to clear screen and Ctrl+L to clear screen and Ctrl+Shift+L to clear the command history.

    For the new console commands…

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

    I find them useful but I’d split the clear screen from the clear history (history-clear) and if you want to clear both perhaps a “clear-all”.

    Same for the button, I’d add a different button for clearing the history.


    Please keep in mind that new features like this may not be merged and help would be also much appreciated in the new QML GUI.

  25. waketraindev commented at 11:36 am on September 26, 2025: contributor

    Thanks a lot for the review!

    The shortcut is already documented as "Use %9 to clear both the screen and the command history.\n", but I can update it to match the exact wording you suggested.

    About splitting the clear functionality: since the output history already includes the input commands, I’m not sure there’s much benefit in clearing just the commands while keeping the output. But if you think it’s more useful that way, I’m happy to adjust and split them.

    On the QML side, I don’t see a mockup of the RPC console yet, and I feel like starting it from scratch on my own might not be the best approach. These are features I use myself right now, so I think they add value in the current console even before the experimental QML GUI is ready.

  26. waketraindev marked this as a draft on Oct 5, 2025
  27. waketraindev force-pushed on Oct 13, 2025
  28. waketraindev force-pushed on Oct 14, 2025
  29. waketraindev force-pushed on Oct 14, 2025
  30. waketraindev commented at 8:31 pm on October 14, 2025: contributor

    Rebased on current master. Simplified to console commands only, dropped the keyboard shortcut and clear button (no new buttons added). Added the clear-all command for completness and ease of use.

    Tested all commands (clear, clear-all, history, history-clear) on Ubuntu 24.04 and Windows 11 – all work as expected.

  31. waketraindev renamed this:
    Add reset button and console commands for clearing output/history
    qt: add console commands for clearing output and history
    on Oct 14, 2025
  32. waketraindev marked this as ready for review on Oct 14, 2025
  33. waketraindev force-pushed on Oct 14, 2025
  34. waketraindev force-pushed on Oct 19, 2025
  35. waketraindev commented at 11:00 am on October 25, 2025: contributor
    I’d appreciate any suggestions on discoverability of these console commands.
  36. waketraindev force-pushed on Nov 3, 2025
  37. waketraindev commented at 5:41 pm on November 3, 2025: contributor
    Added release notes file.
  38. hebasto renamed this:
    qt: add console commands for clearing output and history
    Add console commands for clearing output and history
    on Nov 3, 2025
  39. qt: add console commands for clearing screen, clearing and viewing history
    Adds the following console commands:
    
    - `clear`: clears the console output area.
    - `clear-all`: clears both output and command history.
    - `history`: lists stored command history.
    - `history-clear`: clears command history only.
    
    These additions improve privacy and convenience in shared or long-lived
    sessions by allowing users to remove sensitive commands and output from view.
    e2a3674141
  40. waketraindev force-pushed on Nov 3, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-07 18:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me