qt: add shift key modifier to clear command history when clearing the console #882

pull waketraindev wants to merge 1 commits into bitcoin-core:master from waketraindev:2025-07-console-clear-history changing 1 files +3 −0
  1. waketraindev commented at 11:41 am on July 30, 2025: none
    If Shift is held clears command history when clearing console in Qt. Adds Ctrl+Shift+L shortcut to reset console.
  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.

  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: none

    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: none
    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: none
    Updated the patch to only clear input when Shift is held; also added Ctrl+Shift+L as a secondary shortcut.
  12. qt: add Ctrl+Shift+L to clear console and history; clear input only when Shift is held 73d2cf966e
  13. waketraindev force-pushed on Aug 5, 2025
  14. 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
  15. waketraindev marked this as ready for review on Aug 6, 2025
  16. 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.


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-08-31 12:20 UTC

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