Skip to content

Commit f914a74

Browse files
committed
Fixed: selection when pattern(_:) capacity is 0...
1 parent d608748 commit f914a74

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/DiffableTextKitXPattern/Style.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ extension PatternTextStyle {
117117
} none: {
118118
commit, virtuals in
119119
commit.snapshot.append(contentsOf: virtuals, as: .phantom)
120-
commit.snapshot.select(commit.snapshot.endIndex)
120+
//=----------------------------------=
121+
// Selection
122+
//=----------------------------------=
123+
switch virtuals.endIndex != pattern.endIndex { // real vs fake
124+
case true: commit.snapshot.select(commit.snapshot .endIndex)
125+
case false: commit.snapshot.select(commit.snapshot.startIndex) }
121126
} done: {
122127
commit, virtuals, mismatches in
123128
//=----------------------------------=

0 commit comments

Comments
 (0)