Skip to content

Commit

Permalink
Restore selection workaround for rendering attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Dec 20, 2024
1 parent a3dcc55 commit ace5e37
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/Glyph/NSTextView+Additions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,22 @@ extension TextView {
return
}

// apply a workaround to force rendering attributes to be applied immediately
#if os(macOS)
let selection = self.selectedRanges
#else
let selection = self.selectedRange
#endif

textLayoutManager.setRenderingAttributes(attributes, for: textRange)

#if os(macOS)
self.selectedRanges = [NSValue(range: range)]
self.selectedRanges = selection
#else
self.selectedRange = range
self.selectedRange = selection
#endif
return
}

Expand Down

0 comments on commit ace5e37

Please sign in to comment.