File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ extension Range {
3434 //=--------------------------------------=
3535 // MARK: Return
3636 //=--------------------------------------=
37- from ( source, lower: bound, upper: bound)
37+ Self . from ( source, lower: bound, upper: bound)
3838 }
3939
4040 @inlinable static func from< T> ( _ source: Range < T > ,
@@ -54,6 +54,6 @@ extension Range {
5454 //=--------------------------------------=
5555 // MARK: Return
5656 //=--------------------------------------=
57- return . unchecked ( ( lowerBound, upperBound) )
57+ return Self ( uncheckedBounds : ( lowerBound, upperBound) )
5858 }
5959}
Original file line number Diff line number Diff line change @@ -20,15 +20,16 @@ public struct Changes {
2020
2121 public let snapshot : Snapshot
2222 public var replacement : Snapshot
23- public var indices : Range < Index >
23+ public var range : Range < Index >
2424
2525 //=------------------------------------------------------------------------=
2626 // MARK: Initializers
2727 //=------------------------------------------------------------------------=
2828
29- @inlinable init ( _ snapshot: Snapshot , with characters: String , at indices : Range < Index > ) {
30- self . snapshot = snapshot; self . indices = indices
29+ @inlinable init ( _ snapshot: Snapshot , with characters: String , in range : Range < Index > ) {
30+ self . snapshot = snapshot
3131 self . replacement = Snapshot ( characters, as: . content)
32+ self . range = range
3233 }
3334
3435 //=------------------------------------------------------------------------=
@@ -37,6 +38,8 @@ public struct Changes {
3738
3839 /// Returns a new snapshot with the proposed change applied to it.
3940 @inlinable public func proposal( ) -> Snapshot {
40- var result = snapshot; result. replaceSubrange ( indices, with: replacement) ; return result
41+ var proposal = snapshot
42+ proposal. replaceSubrange ( range, with: replacement)
43+ return proposal
4144 }
4245}
Original file line number Diff line number Diff line change 1111// MARK: * Context
1212//* ============================================================================*
1313
14- /// Values describing the state of a diffable text view.
14+ /// A set of values describing the state of a diffable text view.
1515///
16- /// - Copy -on-write.
16+ /// - Uses copy -on-write.
1717///
1818public struct Context < Style: DiffableTextStyle > {
1919 public typealias Commit = DiffableTextKit . Commit < Value >
@@ -222,13 +222,13 @@ public extension Context {
222222 //=--------------------------------------=
223223 // MARK: Values
224224 //=--------------------------------------=
225- let indices = snapshot. indices ( at: range)
225+ let range = snapshot. indices ( at: range)
226226 let commit = try style. merge ( Changes (
227- snapshot, with: characters, at : indices ) )
227+ snapshot, with: characters, in : range ) )
228228 //=--------------------------------------=
229229 // MARK: Update
230230 //=--------------------------------------=
231- self . set ( selection: indices . upperBound)
231+ self . set ( selection: range . upperBound)
232232 self . merge ( Self . focused ( style, commit) )
233233 }
234234
You can’t perform that action at this time.
0 commit comments