React to a command being selected from the dropdown. Args: event: The option selection event.
(self, event: OptionList.OptionSelected)
| 1188 | |
| 1189 | @on(OptionList.OptionSelected) |
| 1190 | def _select_command(self, event: OptionList.OptionSelected) -> None: |
| 1191 | """React to a command being selected from the dropdown. |
| 1192 | |
| 1193 | Args: |
| 1194 | event: The option selection event. |
| 1195 | """ |
| 1196 | event.stop() |
| 1197 | self._cancel_gather_commands() |
| 1198 | input = self.query_one(CommandInput) |
| 1199 | with self.prevent(Input.Changed): |
| 1200 | assert isinstance(event.option, Command) |
| 1201 | hit = event.option.hit |
| 1202 | input.value = str(hit.text) |
| 1203 | self._selected_command = hit |
| 1204 | input.action_end() |
| 1205 | self._list_visible = False |
| 1206 | self.query_one(CommandList).clear_options() |
| 1207 | self._hit_count = 0 |
| 1208 | if self.run_on_select: |
| 1209 | self._select_or_command() |
| 1210 | |
| 1211 | @on(Input.Submitted) |
| 1212 | @on(Button.Pressed) |
nothing calls this directly
no test coverage detected