Skip to content

Commit 28adcfc

Browse files
textSet -> characterIndexes
1 parent d81d888 commit 28adcfc

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies: [
2525
### `NSTextContainer` Additions
2626

2727
```swift
28-
func textSet(for rect: CGRect) -> IndexSet
28+
func characterIndexes(within rect: CGRect) -> IndexSet
2929
func enumerateLineFragments(for rect: CGRect, strictIntersection: Bool, block: (CGRect, NSRange, inout Bool) -> Void)
3030
func enumerateLineFragments(in range: NSRange, block: (CGRect, NSRange, inout Bool) -> Void)
3131
```
@@ -45,8 +45,9 @@ func enumerateLineFragments(with provider: NSTextElementProvider, block: (NSText
4545

4646
### `NSTextView`/`UITextView` Additions
4747

48-
```swift
49-
var visibleTextSet: IndexSet
48+
```
49+
func characterIndexes(within rect: CGRect) -> IndexSet
50+
var visibleCharacterIndexes: IndexSet
5051
```
5152

5253
## Contributing and Collaboration

Sources/Glyph/NSTextContainer+Additions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extension NSTextContainer {
5454
}
5555

5656
/// Returns an IndexSet representing the content within `rect`.
57-
public func textSet(for rect: CGRect) -> IndexSet {
57+
public func characterIndexes(within rect: CGRect) -> IndexSet {
5858
var set = IndexSet()
5959

6060
enumerateLineFragments(for: rect, strictIntersection: true) { _, range, _ in

Sources/Glyph/NSTextView+Additions.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ extension TextView {
2121
}
2222

2323
/// Returns an IndexSet representing the content within `rect`.
24-
public func textSet(for rect: CGRect) -> IndexSet {
24+
public func characterIndexes(within rect: CGRect) -> IndexSet {
2525
#if os(macOS) && !targetEnvironment(macCatalyst)
26-
return textContainer?.textSet(for: rect) ?? IndexSet()
26+
return textContainer?.characterIndexes(within: rect) ?? IndexSet()
2727
#elseif os(iOS) || os(visionOS)
28-
return textContainer.textSet(for: rect)
28+
return textContainer.characterIndexes(within: rect)
2929
#endif
3030
}
3131

3232
/// Returns an IndexSet representing the visible content.
33-
public var visibleTextSet: IndexSet {
34-
textSet(for: visibleContainerRect)
33+
public var visibleCharacterIndexes: IndexSet {
34+
characterIndexes(within: visibleContainerRect)
3535
}
3636
}
3737
#endif

0 commit comments

Comments
 (0)