Skip to content

Commit

Permalink
match all instances of a highlight on each line
Browse files Browse the repository at this point in the history
  • Loading branch information
sproctor committed Jan 20, 2025
1 parent 2652635 commit 3bd1506
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fun AnnotatedString.highlight(highlights: List<ViewHighlight>): AnnotatedStringH
val entireLineStyles = mutableListOf<StyleDefinition>()
val text = with(AnnotatedString.Builder(this)) {
highlights.forEach { highlight ->
highlight.regex.find(text)?.let { result ->
highlight.regex.findAll(text).forEach { result ->
for ((index, group) in result.groups.withIndex()) {
if (group != null) {
highlight.styles[index]?.let { style ->
Expand Down

0 comments on commit 3bd1506

Please sign in to comment.