fix(tui): replace provider template chip row with a template field and grouped picker - #428
Merged
Merged
Conversation
…d grouped picker The provider Add form rendered all templates as a single horizontal chip row. With three built-ins plus ten sponsor presets the row overflows any realistic terminal width, and the overflow was silently clipped: the selected chip and the sponsor entries could become invisible and unreachable (#416). Template selection is now a regular field at the top of the Fields table, mirroring the Usage Query page pattern: - The Template field shows only the current selection as a chip-styled value with a dim caret and total count, degrading label-first at narrow widths. Nothing can overflow horizontally anymore. - Enter on the field opens a new ProviderTemplatePicker overlay: a vertical list grouped into Built-in and Sponsors (Codex's DeepSeek stays under Built-in), with section headers skipped by Up/Down and the selection kept in view via the shared scroll window. - Applying keeps the exact legacy semantics (apply_template with existing ids, common-snippet quick-config refresh, warning toast on failure) and lands the cursor on the first real field. Esc changes nothing. - The dedicated Templates pane and focus stop are gone for the provider form; Tab now cycles Fields <-> JSON preview (Codex: Fields -> Auth preview -> Config preview). The MCP form and the CLI chooser are untouched. - The copy-provider flow opens on the first real field instead of the template row, so its copied values stay one keypress away from harm. - The contextual ? help documents the picker keys, the sponsor grouping, and precisely what applying a template does and does not reset, in both English and Chinese. Closes #416
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #416. Thanks @LeonardoTan19 for the report and the offer to help — this ended up as a UX redesign rather than a scroll fix, details below.
Problem
The provider Add form rendered every template as one horizontal chip row. With 3 built-ins + 10 sponsor presets (~135 columns), the row overflows any realistic terminal width, and the overflow was silently clipped: the selected chip — and the sponsor entries — could become invisible and unreachable.
Approach
Instead of adding horizontal scrolling (which would keep most sponsors hidden behind the fold), template selection now follows the same pattern the Usage Query page already uses — a field whose Enter opens a picker:
▾ (N)count, followed by a divider. Label-first degradation at narrow widths (count dropped first, then the caret, then the label truncates). Nothing can overflow horizontally anymore.ProviderTemplatePicker): Built-in / Sponsors sections (Codex's DeepSeek stays under Built-in), ↑/↓ skip section headers, selection kept in view via the shared scroll window on short terminals.apply_templatewith existing provider ids (id de-confliction covered by a test), common-snippet quick-config refresh, warning toast on failure — then the cursor lands on the first real field. Esc changes nothing, including typed API keys and usage-query settings.?help rewritten (EN + ZH) to document the picker keys, the sponsor grouping, and — precisely — what applying a template does and does not reset (it deliberately avoids over-promising: some previously typed values survive a template switch, so the help now says not to rely on templates to clear secrets).Screenshot-able flow
Providers → a→ first row isTemplate [ Custom ] ▾ (13)→ Enter opens the grouped list → pick → cursor lands on Name.Validation
cargo fmt --checkclean; no new clippy warnings in touched files.cli::tuisuite: 1799 passed (≈20 new behavior tests: no-apply-on-open, header skipping incl. Codex display-order divergence, id de-confliction, Esc purity with typed secrets, warning-toast path, scroll-into-view at 100×13, narrow-width degradation ladder, copy-flow initial focus, help routing). Full-suite failures are byte-identical to the pre-change baseline on this machine (pre-existing umask/sandbox failures, none incli::tui).?help text was additionally fact-checked claim-by-claim againstapply_template.Note:
cargo clippycurrently cannot exit clean onmaindue to a pre-existingreversed_empty_rangesdeny error insrc/cli/tui/ui/home_chart.rs:806(untouched here) — worth a separate small fix.