Skip to content

Commit f4621ba

Browse files
committed
Allow to specify show_numbers in ChoiceInput
Fixes #2058
1 parent 940af53 commit f4621ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/prompt_toolkit/shortcuts/choice_input.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class ChoiceInput(Generic[_T]):
7575
:param mouse_support: Enable mouse support.
7676
:param style: :class:`.Style` instance for the color scheme.
7777
:param symbol: Symbol to be displayed in front of the selected choice.
78+
:param show_numbers: Whether to show the option numbers in front of each choice.
7879
:param bottom_toolbar: Formatted text or callable that returns formatted
7980
text to be displayed at the bottom of the screen.
8081
:param show_frame: `bool` or
@@ -97,6 +98,7 @@ def __init__(
9798
mouse_support: bool = False,
9899
style: BaseStyle | None = None,
99100
symbol: str = ">",
101+
show_numbers: bool = True,
100102
bottom_toolbar: AnyFormattedText = None,
101103
show_frame: FilterOrBool = False,
102104
enable_suspend: FilterOrBool = False,
@@ -113,6 +115,7 @@ def __init__(
113115
self.mouse_support = mouse_support
114116
self.style = style
115117
self.symbol = symbol
118+
self.show_numbers = show_numbers
116119
self.show_frame = show_frame
117120
self.enable_suspend = enable_suspend
118121
self.interrupt_exception = interrupt_exception
@@ -129,7 +132,7 @@ def _create_application(self) -> Application[_T]:
129132
select_character=self.symbol,
130133
close_character="",
131134
show_cursor=False,
132-
show_numbers=True,
135+
show_numbers=self.show_numbers,
133136
container_style="class:input-selection",
134137
default_style="class:option",
135138
selected_style="",

0 commit comments

Comments
 (0)