File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Sources/DiffableTextKit/Styles Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -83,18 +83,18 @@ public struct PrefixTextStyle<Base: DiffableTextStyle>: WrapperTextStyle {
8383 //=--------------------------------------=
8484 // Base x Some
8585 //=--------------------------------------=
86- let size = snapshot. count
86+ let start = snapshot. endIndex
8787 snapshot. append ( contentsOf: base)
8888 //=--------------------------------------=
8989 // Base x Some x Selection
9090 //=--------------------------------------=
9191 guard let selection = base. selection else { return }
92- let min = selection. lower. attribute + size // offset
93- let max = selection. upper. attribute + size // offset
94-
95- let lower = snapshot. index ( snapshot . startIndex , offsetBy: min)
96- let upper = snapshot. index ( lower, /*---*/ offsetBy: max - min)
97- snapshot. selection = Selection . init ( unchecked : ( lower, upper) )
92+ let min = selection . lower. attribute
93+ let max = selection . upper. attribute
94+
95+ let lower = snapshot. index ( start , offsetBy: min)
96+ let upper = snapshot. index ( lower, offsetBy: max - min)
97+ snapshot. select ( Range ( uncheckedBounds : ( lower, upper) ) )
9898 }
9999}
100100
You can’t perform that action at this time.
0 commit comments