Skip to content
Edit this page

ADR-059: Choice search is a presentation hint

Status

Accepted.

Context

Data-driven choice lists can be too large to navigate by scrolling. Choisir provides typed selections with substring and fuzzy matching, arrow-enabled confirmations and text input, while console handles terminal primitives. The initial integration exposed prompt-layout and text-input gaps resolved by choisir 0.2.0.

Decision

Use choisir for text input, selection widgets and confirmations, and console for terminal primitives. Keep these dependencies at the binary edge rather than leak widget types into evaluation or operations. Use the published choisir 0.3.0 crate and its shared MinimalTheme and PromptLayout.

Choice and multi-choice questions use substring typeahead by default. Add an optional question-level fuzzy = true flag for noncontiguous matching. It applies to both inline choices and choices_from, and is rejected when enabled on other question kinds. Omitted and false are equivalent and do not need to be serialized back into manifests. Question introspection reports the boolean explicitly.

Filtering never changes validation, answer identity, defaults, or noninteractive resolution. Selections carry underlying values independently of labels, including duplicate labels. Multi-selection preserves checked values across filtering and returns them in original input order. Space toggles multi-choice selections rather than becoming part of the query. Escape clears a query before cancelling; Ctrl-C cancels a selection immediately. Consent and hunk menus initially keep search disabled. Enable viewport-based PageUp/PageDown navigation for question choices and backport hunks. Paging clamps at the endpoints and preserves checked values and their original result order.

Consequences

This is an additive manifest extension and an interactive UX change, not a change to rendered-value semantics. Existing templates and unattended answer sets remain valid. Stderr must remain a terminal for interactive widgets, while stdout may carry JSON or mailbox data. Automation uses explicit answers/defaults instead of a line-oriented stdin fallback.

Help is structured prompt metadata, displayed dimmed beside the question rather than printed separately. Text editing moves below help-bearing headings and otherwise stays inline, with dimmed ghost defaults. Option descriptions use a single row beside their label without becoming searchable text. Confirmation controls always appear below the heading and help, with or without help text. Accepted summaries remain compact and omit help. Escape and Ctrl-C return typed cancellation from all question widgets; cancelling a reversal still declines it. See the contributing guide for terminal verification.