Skip to content

Commit

Permalink
Use fast init for IndexSet
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Oct 14, 2024
1 parent 77d4a12 commit f3c717b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/Neon/TextViewSystemInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ extension TextViewSystemInterface: TextSystemInterface {
}

public var visibleSet: IndexSet {
IndexSet(textView.visibleTextRange)
IndexSet(integersIn: textView.visibleTextRange)
}

public var content: NSTextStorage {
Expand Down Expand Up @@ -118,7 +118,7 @@ public struct LayoutManagerSystemInterface {
public init?(textView: TextView, attributeProvider: @escaping TokenAttributeProvider) {
guard let layoutManager = textView.layoutManager else { return nil }
self.layoutManager = layoutManager
self.visibleSetProvider = { IndexSet(textView.visibleTextRange) }
self.visibleSetProvider = { IndexSet(integersIn: textView.visibleTextRange) }
self.attributeProvider = attributeProvider
}
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public struct TextLayoutManagerSystemInterface {
public init?(textView: TextView, attributeProvider: @escaping TokenAttributeProvider) {
guard let textLayoutManager = textView.textLayoutManager else { return nil }
self.textLayoutManager = textLayoutManager
self.visibleSetProvider = { IndexSet(textView.visibleTextRange) }
self.visibleSetProvider = { IndexSet(integersIn: textView.visibleTextRange) }
self.attributeProvider = attributeProvider
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ public struct TextStorageSystemInterface {
#else
self.textStorage = textView.textStorage
#endif
self.visibleSetProvider = { IndexSet(textView.visibleTextRange) }
self.visibleSetProvider = { IndexSet(integersIn: textView.visibleTextRange) }
self.attributeProvider = attributeProvider
self.defaultAttributesProvider = { textView.typingAttributes }
}
Expand Down

0 comments on commit f3c717b

Please sign in to comment.