feat(tui): palette book-name suggestions with fuzzy match#12
Merged
Conversation
PASS WITH WARNINGS (0 critical / 2 warning / 2 suggestion). All 16 REQs satisfied, 178 tests green, tsc clean. Tab key works as designed — OpenTUI doesn't consume keys with charCode < 32, so Tab (9) reaches useKeyboard cleanly. No fallback key needed. Pending: manual PTY smoke of the actual fuzzy-finder UX.
OpenTUI's <input> fires onChange on commit/blur, not per keystroke (matching DOM semantics, not React's onChange override). The reader was wired to onChange, so state.query only updated when Enter fired onSubmit — meaning suggestBooks always saw an empty string and the suggestion list never appeared while typing. onInput is the per-keystroke event in OpenTUI. Switching to it makes QueryTyped dispatch on every character, suggestions populate live, and the list renders as the user types. This bug was latent in PRs #10 and #11 too — the reader still worked because onChange fires before onSubmit on Enter, so the final value landed in state.query just in time for QuerySubmitted. But during typing, state.query was perpetually one step behind.
SDD cycle closed. PASS WITH WARNINGS verify + 1 user-sanctioned post-verify fix (onChange→onInput so suggestions update on every keystroke). 178/178 tests pass. Manual PTY smoke confirmed by user. Out-of-scope follow-ups: chapter picker after book pick (backlog, not on v1 roadmap); USFM code column alignment (cosmetic); recent references / history; chapter-level suggestions within a book.
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.
Summary
Live book-name suggestions in the reader's palette.
johmatches John, 1 John, 2 John, 3 John;1samatches 1 Samuel."1samuel"→"1 Samuel").awaitinggainssuggestions: BookSuggestion[]andselectedIndex: number. New actionsSuggestionMovedUp/Down/Accepted; existing handlers updated to maintain the new fields.fg={ACCENT_HEX}matching the verse-cursor pattern; canonical USFM code in DIM on the right.↑/↓/Tabflow through to suggestion actions while inawaiting; other reader keys stay suppressed.q/Qquit still works above the gate.Tabaccepts the selected suggestion (rewrites input to{DisplayName}ready for chapter typing).Enteralways submits the query as-typed. No ambiguity.What does NOT change
book-suggestions.ts) and the export ofBOOK_ALIASES.getPassage,getChapter) unchanged.Verify
SDD verify: PASS WITH WARNINGS (0 critical / 2 warning / 2 suggestion). All 16 REQs satisfied. One post-verify fix from manual PTY smoke:
9d5b4df—onChange→onInput. OpenTUI's<input>uses DOM semantics:onChangefires on commit/blur,onInputfires per keystroke. The reader was wired toonChange, sostate.querylagged andsuggestBooksalways received an empty string during typing. One-line fix. This bug was latent in PRs #10 and #11 too (those still worked becauseonChangefires just beforeonSubmiton Enter), but this is the first PR that depends on per-keystroke updates.bun test: 178/178 pass.bun run tsc --noEmit: exits 0.Test plan
bun test178/178Out of scope
--format, mouse input — those should land before more palette UX polish.Full SDD trail in `openspec/changes/archive/palette-suggestions/`.