Skip to content

A capital after a supplementary-plane digit (e.g. U+1D7D1 𝟑) gets no camelCase bonus: #132 checks only the high surrogate #133

Closed

Description

@matt-edmondson

What's wrong

#132 gave a capital after a digit the camelCase bonus. The digit check is prevDigit = char.IsDigit(strChar); (FuzzySearch/Fuzzy.cs:333).

strChar is only the first UTF-16 unit. For a supplementary-plane decimal digit (category Nd, for example U+1D7D1 MATHEMATICAL BOLD DIGIT THREE), that unit is a high surrogate, so IsDigit is false and the next capital gets no bonus.

This is the same gap #110 fixed for supplementary-plane capitals. It contradicts the comment around line 226, which says case and kind are read from the whole code point, and the camelCaseMatchBonus doc ("an uppercase letter after a lowercase letter or a digit").

Repro

Fuzzy.Contains("Vector3Distance", "vd", out int a);            // 7
Fuzzy.Contains("Vector٣Distance", "vd", out int b);       // 7  (Arabic-Indic 3, basic plane)
Fuzzy.Contains("Vector\U0001D7D1Distance", "vd", out int c);   // -3, expected 7

Real-world impact is low, but the result is plainly inconsistent with the documented rule.

Suggested fix

Classify the whole code point when strCharLength == 2:

  • On NETCOREAPP3_0_OR_GREATER, use Rune.IsDigit.
  • Elsewhere, use CharUnicodeInfo.GetUnicodeCategory(s, i) == UnicodeCategory.DecimalDigitNumber, the pattern GetLetterCase already uses.

Folding this into a GetLetterCase-style helper that also reports "is digit" would keep the two checks consistent.

Acceptance: the third call above scores 7, and a test with a supplementary-plane digit sits beside the #132 tests.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. matt-edmondson commented on Nov 4, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions