Skip to content

Commit 651fcbc

Browse files
committed
Fixed fa9a62d: selection on inactive to active focus transition
1 parent 6d771e1 commit 651fcbc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Sources/DiffableTextKit/Models/Layout.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
//=------------------------------------------------------------------------=
3232

3333
@inlinable init(_ snapshot: Snapshot, preference: Selection<Index>?) {
34-
self.snapshot = snapshot; self.preference = preference; self.selection = .initial(snapshot)
34+
self.snapshot = snapshot
35+
self.preference = preference
36+
self.selection = Selection(snapshot.endIndex)
37+
self.merge(selection: self.selection)
3538
}
3639

3740
//=------------------------------------------------------------------------=

Sources/DiffableTextKit/Models/Selection.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ public struct Selection<Bound: Comparable>: CustomStringConvertible, Equatable {
4848
Self(unchecked: (collection.startIndex, collection.endIndex))
4949
}
5050

51-
@inlinable static func initial(_ collection: Snapshot) -> Self where Bound == Snapshot.Index {
52-
Self(collection.resolve(Caret.upper(collection.endIndex)))
53-
}
54-
5551
//=------------------------------------------------------------------------=
5652
// MARK: Accessors
5753
//=------------------------------------------------------------------------=

0 commit comments

Comments
 (0)