Skip to content
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

Ignore Unknown keys #192

Merged
merged 1 commit into from Jan 14, 2023

Commits on May 7, 2022

  1. Ignore Unknown keys

    There are a few keystrokes which cause `console-rs` to produce `Unknown`
    keys. At the time of this commit this includes pressing the `Control`
    key, but also previously included `Shift` and `Alt`.
    
    Pressing these keys under a *nix terminal does not appear to produce a
    "key" at all - rather the user must press a complete key chord before
    `Term::read_key()` will produce a result.
    
    Looking at the `console-rs` source, we can see that it produces an
    `Unknown` key under Windows in at least two cases:
    
    1. When the console is not "attended"
    2. When the key code does not map to a known key in the Key enum
    
    Since `dialoguer` is already checking for non-attended consoles and
    executing an early return we can rule out needing to handle that
    scenario. For the second scenario, it seems reasonable to ignore any "key"
    not recognized by `console-rs` for the purposes of the Input component.
    deadalusai committed May 7, 2022
    Configuration menu
    Copy the full SHA
    bec13eb View commit details
    Browse the repository at this point in the history