Skip to content

Treat a losing rematch as unmatched for the next letter [patch] - #131

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/130-losing-rematch-adjacency
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/130-losing-rematch-adjacency

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #130

What changed

In Fuzzy.Contains, a copy of the best letter that loses the rematch was charged as a skipped letter, but control then fell through to prevMatched = true. The codepoint after it got the +5 adjacency bonus and counted as continuing a run, which stopped a later camelCase or separator copy from displacing it.

The losing-rematch branch now records that the codepoint stayed unmatched, so prevMatched is false for the next codepoint. The bookkeeping for prevLower/prevSeparator and the indices is unchanged.

Subject / pattern Before After
EditItemManager / em 2 12 (same as EditItxmManager)
axaB / ab 23 ≤ axB (19)
Baxab / bab 18 same as Baxxb

Tests

  • New Score_LosingRematch_DoesNotGrantNextLetterAdjacency (3 cases) and Score_LosingRematch_DoesNotRaiseScore.
  • With the fix reverted, three of the four cases fail. With the fix, all 120 tests pass (dotnet test).

Note: per the issue's triage, open PR #129 (CompatibilitySuppressions) may need to land first for pack to pass on CI.


Generated by Claude Code

A copy of the best letter that loses the rematch was already charged as a
skipped letter, but it still set prevMatched. The next codepoint then got the
adjacency bonus and counted as continuing a run, which stopped a later
camelCase or separator copy from displacing it. Scores could exceed any
alignment the documented rules allow, and changed when an unmatched letter
changed: "EditItemManager"/"em" scored 2 against 12 for "EditItxmManager".

Fixes #130

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5jAJ5C3wivQLYNkMm
@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants