Skip to content

Commit ef14a45

Browse files
committed
#35 Fix for attribute's range set
1 parent 7de6931 commit ef14a45

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Sources/SwiftRichString/Style/StyleProtocol.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ public extension StyleProtocol {
5151
func set(to source: String, range: NSRange?) -> AttributedString {
5252
let attributedText = NSMutableAttributedString(string: source)
5353
self.fontData?.addAttributes(to: attributedText, range: nil)
54-
guard let range = range else {
55-
return attributedText
56-
}
57-
attributedText.setAttributes(self.attributes, range: range)
54+
attributedText.setAttributes(self.attributes, range: (range ?? NSMakeRange(0, source.count)))
5855
return attributedText
5956
}
6057

0 commit comments

Comments
 (0)