Skip to content

Commit e482a6b

Browse files
committed
Cleanup: PatternTextStyle format(_;) and interpret(_:)
1 parent 3c8c322 commit e482a6b

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

Sources/DiffableTextStylesXPattern/Style.swift

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,19 @@ extension PatternTextStyle {
7575
characters.append(contentsOf: queue)
7676
} done: {
7777
characters, queue, contents in
78-
visible ? characters += queue : ()
79-
guard !contents.isEmpty else { return }
80-
characters.append("|")
81-
characters.append(contentsOf: contents)
78+
//=----------------------------------=
79+
// MARK: Pattern
80+
//=----------------------------------=
81+
if visible {
82+
characters.append(contentsOf: queue)
83+
}
84+
//=----------------------------------=
85+
// MARK: Mismatches
86+
//=----------------------------------=
87+
if !contents.isEmpty {
88+
characters.append("|")
89+
characters.append(contentsOf: contents)
90+
}
8291
}
8392
}
8493
}
@@ -106,7 +115,12 @@ extension PatternTextStyle {
106115
commit.snapshot.anchor()
107116
} done: {
108117
commit, queue, _ in
109-
visible ? commit.snapshot += Snapshot(queue, as: .phantom) : ()
118+
//=----------------------------------=
119+
// MARK: Pattern
120+
//=----------------------------------=
121+
if visible {
122+
commit.snapshot.append(contentsOf: Snapshot(queue, as: .phantom))
123+
}
110124
}
111125
}
112126
}

0 commit comments

Comments
 (0)