Skip to content

Commit

Permalink
take the token ranges themselves into account when applying styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed May 10, 2022
1 parent af647ff commit 0e45846
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Neon/Highlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ extension Highlighter {
private func handleTokens(_ tokenApplication: TokenApplication, for range: NSRange) {
self.pendingSet.remove(integersIn: range)

let receivedSet = IndexSet(integersIn: range)
var receivedSet = IndexSet(integersIn: range)

let tokenRanges = tokenApplication.tokens.map({ $0.range })

receivedSet.insert(ranges: tokenRanges)

textInterface.apply(tokenApplication, to: receivedSet)

Expand Down

0 comments on commit 0e45846

Please sign in to comment.