@@ -41,11 +41,11 @@ public struct PrefixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
4141 }
4242
4343 @inlinable public func interpret( _ value: Value , with cache: inout Cache ) -> Commit < Value > {
44- var S0 = base. interpret ( value, with: & cache) ; label ( & S0) ; return S0
44+ var S0 = base. interpret ( value, with: & cache) ; label ( & S0. snapshot ) ; return S0
4545 }
4646
4747 @inlinable public func resolve( _ proposal: Proposal , with cache: inout Cache ) throws -> Commit < Value > {
48- var S0 = try base. resolve ( proposal, with: & cache) ; label ( & S0) ; return S0
48+ var S0 = try base. resolve ( proposal, with: & cache) ; label ( & S0. snapshot ) ; return S0
4949 }
5050
5151 //=------------------------------------------------------------------------=
@@ -57,18 +57,18 @@ public struct PrefixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
5757 text = prefix + text
5858 }
5959
60- @inlinable func label( _ commit : inout Commit < Value > ) {
60+ @inlinable func label( _ snapshot : inout Snapshot ) {
6161 guard !prefix. isEmpty else { return }
62- let base = commit . snapshot
63- commit . snapshot = Snapshot ( prefix, as: . phantom)
64- let size = commit . snapshot. count
65- commit . snapshot. append ( contentsOf: base)
62+ let base = snapshot
63+ snapshot = Snapshot ( prefix, as: . phantom)
64+ let size = snapshot. count
65+ snapshot. append ( contentsOf: base)
6666
6767 guard let selection = base. selection else { return }
6868 let offsets = selection. map ( { size + $0. attribute } )
69- let lower = commit . snapshot. index ( commit . snapshot. startIndex, offsetBy: offsets. lower)
70- let upper = commit . snapshot. index ( lower, offsetBy: /**/ offsets. upper - offsets. lower)
71- commit . snapshot. select ( Range ( uncheckedBounds: ( lower, upper) ) )
69+ let lower = snapshot. index ( snapshot. startIndex, offsetBy: offsets. lower)
70+ let upper = snapshot. index ( lower, offsetBy: offsets. upper - offsets. lower)
71+ snapshot. select ( Range ( uncheckedBounds: ( lower, upper) ) )
7272 }
7373}
7474
0 commit comments