mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-23 00:02:27 +00:00
`fuzzy_score` adds 120 when the folded haystack equals the needle. Only a single-word title can: the needle drops whitespace so `newtab` and `new tab` both match, while the haystack keeps it, so `Settings` can equal its query and `New Tab` never can. Nothing is wrong with the ranking -- typing any of twenty overlapping titles in full ranks that title first, `New Tab` over `New Worktree Tab` and `Rename Tab` over `Reopen Closed Tab`. The word-start and run bonuses carry it without the 120. But that is not visible from the branch, and somebody tuning either bonus deserves to know what is holding the case up. I wrote a test for the whole-list outcome first and threw it away: it survived weakening the word-start bonus from 12 to 1, deleting the length penalty, the run bonus, the prefix bonus and the exact bonus. Typing a complete title matches from position 0 with nothing skipped, which dominates under any scoring this file is likely to have, so the test asserted something no plausible change breaks. The pairwise tests beside it -- initials over scattered letters, exact over mid-string -- are the ones with teeth.