Skip to content

Highlight every match of each search token - #29

Open
Jeehut wants to merge 2 commits into
mainfrom
wip/highlight-all-matches
Open

Jeehut wants to merge 2 commits into
mainfrom
wip/highlight-all-matches

Conversation

@Jeehut

@Jeehut Jeehut commented Nov 21, 2026

Copy link
Copy Markdown
Member

highlightMatchingTokenizedPrefixes(in:locale:applyingAttributes:) marked only the first match of each search token. Searching "he" in "Hello hello" highlighted the first "He" only.

The search now continues after each match, so every occurrence is marked, including overlapping ones ("ana" in "banana" marks both). Matching inside a word works as before, as do case and diacritic insensitivity. The DocC topic link in Extensions.md named the parameter with:; it is corrected to applyingAttributes:.

How this was verified

  • Red on main (589e450): the new test got ["He"] instead of ["He", "He"].
  • Green on the branch: swift test --build-system swiftbuild, 42 tests in 13 suites passed, including the overlap cases "banana"/"ana" and "aaaa"/"aaa".
  • Not checked: a rendered UI with highlights. Review: Code ✓ · Design – · QA –

Note: this PR and the toRGBA PR change neighbouring lines in Extensions.md; the second one to merge needs a small rebase.

Door two-way · Blast Radius breit (public API, re-exported by FlineDevKit)

highlightMatchingTokenizedPrefixes searched each token once with
range(of:), so only its first occurrence was highlighted. Searching
"he" in "Hello Hello" marked the first "He" only.

Repeat the search after each match until the end of the string. The
comparison options and the in-word matching stay as they were.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant