refactor(eve): stop hand-maintaining what the dev TUI already knows - #1470
Merged
Conversation
Two places kept a copy of something the code could derive. `MAX_VISIBLE_SUGGESTIONS` was a hand-maintained mirror of the command registry's length, with a comment instructing the next author to bump it — and it had already drifted to 11 against 10 entries. Worse, `command-typeahead.test.ts` asserted the bare-slash row count as `Math.min(PROMPT_COMMANDS.length, 10)`, which matches today only because `min(10, 11)` and `min(10, 10)` agree: adding an 11th command and bumping the constant as instructed would have failed that test. The constant now reads the registry, so the "never scroll a real command out of view" invariant holds mechanically, and both test expectations reference the registry instead of a literal. In `wrapVisibleLine`, the #1442 linear-time rewrite spelled its "consume one unit" step twice — once inside a single-use `advanceTo` closure, once in the whitespace-collapse loop. One `consume()` closure serves both walks, keeping the single forward pass the rewrite exists for. The empty-line early return is also gone: with no units, the general path already emits exactly one empty row, which a new test now pins. `ansiPattern`, `ansiPrefixPattern`, and `codePointWidth` lose their `export` — nothing outside the module referenced them. Signed-off-by: Chad Hietala <chadhietala@gmail.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
chadhietala
marked this pull request as ready for review
July 31, 2026 15:49
ctgowrie
approved these changes
Jul 31, 2026
AndrewBarba
approved these changes
Jul 31, 2026
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.
Found
MAX_VISIBLE_SUGGESTIONS = 11mirrors a 10-entry command registry by hand.command-typeahead.test.ts:184assertsMath.min(PROMPT_COMMANDS.length, 10), which passes only becausemin(10,11)andmin(10,10)agree — adding an 11th command and bumping the constant as its comment instructs would fail that test.wrapVisibleLinespells its cursor step twice, once behind a single-useadvanceToclosure; the empty-line early return is unreachable; three exports have no outside caller.Did
Derived the constant from
PROMPT_COMMANDS, oneconsume()closure for both walks, dropped the guard and the threeexportkeywords. −24/+24; no user-visible change at 10 commands.Validated
1011 CLI unit tests pass, including a new test pinning
wrapVisibleLine("")and the unmodified 64 KiB linear-time regression test. Two expectation edits now reference the registry instead of literals.tsc --noEmit, lint, fmt,guard:invariantsclean.