Support selectable answers for asynchronous TUI questions (#42894)

## Why

Asynchronous questions can include suggested answers, but the TUI previously displayed only a freeform input. Show those choices and require them to be fully visible before submission.

## What changed

- Render numbered, wrapped choices with a default selection, list navigation, and digit shortcuts. Submit the selected label as the answer.
- Block submission of clipped choices and prompt the user to expand the terminal. Limit option processing to the first 32 entries and discard labels over 512 bytes.
- Preserve freeform input when no usable choices remain, and add contextual submit, skip, and question navigation hints.
- Ignore repeated submit keys so holding a key cannot answer another question.

## Testing

Add state, snapshot, and chat widget tests covering wrapped and clipped choices, constrained layouts, option limits, long answer preservation, oversized answer rejection, key repeats, and conflicting keybindings.

GitOrigin-RevId: 5d3ebadf61da62a9680ba819e6dfcf8302c4e9da
This commit is contained in:
Ian MacLeod authored and copyberry committed 2026-09-05 00:36:20 +00:00
1 parent 218e8df926
commit 07f18d5ff7
17 files changed
+729 -74

No files matched your search

@@ -19,6 +19,14 @@ impl ChatComposer {
self.restore_draft(draft);
}
pub(crate) fn inline_flash(&self) -> Option<Line<'static>> {
self.footer
.flash
.as_ref()
.filter(|_| self.footer.flash_visible())
.map(|flash| flash.line.clone())
}
pub(crate) fn reset_vim_mode(&mut self) {
self.vim_history = VimHistory::default();
self.draft.textarea.enter_vim_insert_mode();