Skip to content

Allow choice prompts to accept a numbered option immediately - #2177

Open
emme1t wants to merge 1 commit into
prompt-toolkit:mainfrom
emme1t:feat/accept-choice-by-number-2020
Open

emme1t wants to merge 1 commit into
prompt-toolkit:mainfrom
emme1t:feat/accept-choice-by-number-2020

Conversation

@emme1t

@emme1t emme1t commented Nov 21, 2026

Copy link
Copy Markdown

Fixes #2020. Passing accept_on_number=True to choice() or ChoiceInput lets a user confirm one of the first nine displayed choices by pressing its number. The default interaction still uses Enter. Arrow keys and mouse selection follow their existing paths.

Five new pipe-input cases cover the default, immediate confirmation, an out-of-range key, navigation with Enter, and hidden numbers. Ruff, formatting, and mypy passed. The full Windows run had 152 passes, five skips, and four failures. All four failures also occurred on the base revision across the full run and a targeted rerun (two Emacs input tests, the session memory test, and console output).

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.

Select an option using a number using Choice() without having to hit enter

1 participant