Skip to content

Commit 02b08c3

Browse files
committed
Updated: Snapshot comment. Cleanup.
1 parent f730e03 commit 02b08c3

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

Sources/DiffableTextKit/Models/Snapshot.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
///
2121
/// **Selection**
2222
///
23-
/// Selection is done by differentiation, but it can also be done manually. It
24-
/// may be appropriate on snapshots containing only formatting characters. A pattern
25-
/// text style can manually select its first placeholder character, for example.
23+
/// Selection is done by differentiation, but it can also be done manually.
24+
/// Snapshots containing only passthrough characters should always provide
25+
/// a manual selection, however. A pattern text style may select its first
26+
/// placeholder, as illustrated:
2627
///
2728
/// ```
28-
/// ↓ == selection
29+
/// ↓ == selection
2930
/// |+|#|#|_|(|#|#|#|)|_|#|#|#|-|#|#|-|#|#|~
3031
/// |x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|~
3132
/// ```

Sources/DiffableTextKit/Styles/Prefix.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public struct PrefixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
4949
}
5050

5151
//=------------------------------------------------------------------------=
52-
// MARK: Utilities
52+
// MARK: Helpers
5353
//=------------------------------------------------------------------------=
5454

5555
@inlinable func label(_ text: inout String) {

Sources/DiffableTextKit/Styles/Suffix.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public struct SuffixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
4949
}
5050

5151
//=------------------------------------------------------------------------=
52-
// MARK: Utilities
52+
// MARK: Helpers
5353
//=------------------------------------------------------------------------=
5454

5555
@inlinable func label(_ text: inout String) {

Sources/DiffableTextKitXPattern/Placeholders.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extension Placeholders {
7373

7474
//=--------------------------------------------------------------------=
7575

76-
@usableFromInline let elements: (character: Character, predicate: Predicate)
76+
@usableFromInline let elements: (Character, Predicate)
7777

7878
//=--------------------------------------------------------------------=
7979

@@ -82,11 +82,11 @@ extension Placeholders {
8282
}
8383

8484
@inlinable subscript(character: Character) -> Predicate? {
85-
elements.character == character ? elements.predicate : nil
85+
elements.0 == character ? elements.1 : nil
8686
}
8787

8888
@inlinable static func == (lhs: Self, rhs: Self) -> Bool {
89-
lhs.elements.character == rhs.elements.character
89+
lhs.elements.0 == rhs.elements.0
9090
}
9191
}
9292

Sources/DiffableTextKitXPattern/Style.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ extension PatternTextStyle {
109109

110110
/// - Mismatches are removed.
111111
@inlinable public func interpret(_ value: Value, with cache: inout Void) -> Commit<Value> {
112-
reduce(with: value, into: Commit()) {
112+
reduce(with: value, into: Commit()) {
113113
commit, virtuals, nonvirtual in
114114
commit.snapshot.append(contentsOf: virtuals, as: .phantom)
115115
commit.snapshot.append(nonvirtual)

0 commit comments

Comments
 (0)