Skip to content

Commit 9fe47b6

Browse files
committed
Cleanup: Prefix & Suffix, misc
1 parent 7d70450 commit 9fe47b6

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

Sources/DiffableTextKit/Models/Context.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,21 @@ extension Context {
118118
// MARK: Storage
119119
//=------------------------------------------------------------------------=
120120

121-
@inlinable @inline(__always) var status: Status { storage.status }
121+
@inlinable var status: Status { storage.status }
122122

123-
@inlinable @inline(__always) var layout: Layout? { storage.layout }
123+
@inlinable var layout: Layout? { storage.layout }
124124

125-
@inlinable @inline(__always) var backup: String? { storage.backup }
125+
@inlinable var backup: String? { storage.backup }
126126

127127
//=------------------------------------------------------------------------=
128128
// MARK: Status
129129
//=------------------------------------------------------------------------=
130130

131-
@inlinable @inline(__always) public var style: Style { status.style }
131+
@inlinable public var style: Style { status.style }
132132

133-
@inlinable @inline(__always) public var value: Value { status.value }
133+
@inlinable public var value: Value { status.value }
134134

135-
@inlinable @inline(__always) public var focus: Focus { status.focus }
135+
@inlinable public var focus: Focus { status.focus }
136136

137137
//=------------------------------------------------------------------------=
138138
// MARK: Layout
@@ -268,7 +268,7 @@ extension Context {
268268
// Update
269269
//=--------------------------------------=
270270
self.unique()
271-
self.storage.layout!.merge(selection: selection,momentums: momentums)
271+
self.storage.layout!.merge(selection: selection, momentums: momentums)
272272
//=--------------------------------------=
273273
// Return
274274
//=--------------------------------------=

Sources/DiffableTextKit/Styles/Prefix.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Sources/DiffableTextKit/Styles/Suffix.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public struct SuffixTextStyle<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
//=------------------------------------------------------------------------=
@@ -56,8 +56,8 @@ public struct SuffixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
5656
text.append(contentsOf: suffix)
5757
}
5858

59-
@inlinable func label(_ commit: inout Commit<Value>) {
60-
commit.snapshot.append(contentsOf: suffix, as: .phantom)
59+
@inlinable func label(_ snapshot: inout Snapshot) {
60+
snapshot.append(contentsOf: suffix, as: .phantom)
6161
}
6262
}
6363

0 commit comments

Comments
 (0)