File tree Expand file tree Collapse file tree 3 files changed +6
-20
lines changed
Expand file tree Collapse file tree 3 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -300,7 +300,7 @@ public extension Character {
300300 @inlinable @inline ( __always) static func distance(
301301 from start: Snapshot . Index , to end: Snapshot . Index ,
302302 in collection: Snapshot ) -> Offset < Self > {
303- Offset ( end . attribute - start. attribute )
303+ Offset ( collection . distance ( from : start, to : end ) )
304304 }
305305
306306 @inlinable @inline ( __always) static func index(
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ extension Snapshot {
187187 }
188188
189189 //=------------------------------------------------------------------------=
190- // MARK: After, Before, Distance
190+ // MARK: After, Before
191191 //=------------------------------------------------------------------------=
192192
193193 @inlinable public func index( after position: Index ) -> Index {
@@ -207,25 +207,11 @@ extension Snapshot {
207207 }
208208
209209 //=------------------------------------------------------------------------=
210- // MARK: Count
210+ // MARK: Distance, Count
211211 //=------------------------------------------------------------------------=
212212
213- /// - Complexity: O(1).
214- @inlinable @inline ( __always)
215- public var isEmpty : Bool {
216- _attributes. isEmpty
217- }
218-
219- /// - Complexity: O(1).
220- @inlinable @inline ( __always)
221- public var count : Int {
222- _attributes. count
223- }
224-
225- /// - Complexity: O(1).
226- @inlinable @inline ( __always)
227- public var underestimatedCount : Int {
228- _attributes. underestimatedCount
213+ @inlinable public func distance( from start: Index , to end: Index ) -> Int {
214+ _attributes. distance ( from: start. attribute, to: end. attribute)
229215 }
230216}
231217
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ extension PatternTextStyle {
232232 if qIndex == pattern. endIndex {
233233 none ( & result, pattern [ pIndex ..< pIndex] )
234234 //=----------------------------------=
235- // Placeholder >= 1
235+ // Placeholders >= 1
236236 //=----------------------------------=
237237 } else {
238238 none ( & result, pattern [ pIndex ..< qIndex] )
You can’t perform that action at this time.
0 commit comments