@@ -95,9 +95,8 @@ export class Overlay implements Printable, Stateful {
9595 const txt = this . txt ;
9696 let hash : number = CONST . START_STATE ;
9797 hash = this . refreshSlices ( hash , txt . savedSlices ) ;
98+ hash = this . refreshSlices ( hash , txt . extraSlices ) ;
9899 hash = this . refreshSlices ( hash , txt . localSlices ) ;
99- // hash = this.refreshCursor(hash);
100- // TODO: refresh ephemeral slices
101100 // if (!slicesOnly) this.computeSplitTextHashes();
102101 return ( this . hash = hash ) ;
103102 }
@@ -137,27 +136,13 @@ export class Overlay implements Printable, Stateful {
137136 return state ;
138137 }
139138
140- private refreshCursor ( state : number ) : number {
141- const cursor = this . txt . editor . cursor ;
142- let tuple : [ start : OverlayPoint , end : OverlayPoint ] | undefined = this . slices . get ( cursor ) ;
143- const positionMoved = tuple && ( tuple [ 0 ] . cmp ( cursor . start ) !== 0 || tuple [ 1 ] . cmp ( cursor . end ) !== 0 ) ;
144- if ( tuple && positionMoved ) {
145- this . delSlice ( cursor , tuple ! ) ;
146- }
147- if ( ! tuple || positionMoved ) {
148- tuple = this . insSlice ( cursor ) ;
149- this . slices . set ( cursor , tuple ) ;
150- }
151- return state ;
152- }
153-
154139 /**
155140 * Retrieve an existing {@link OverlayPoint} or create a new one, inserted
156141 * in the tree, sorted by spatial dimension.
157142 */
158143 protected upsertPoint ( point : Point ) : [ point : OverlayPoint , isNew : boolean ] {
159144 const newPoint = this . overlayPoint ( point . id , point . anchor ) ;
160- const pivot = this . insertPoint ( newPoint ) ;
145+ const pivot = this . insPoint ( newPoint ) ;
161146 if ( pivot ) return [ pivot , false ] ;
162147 return [ newPoint , true ] ;
163148 }
@@ -167,7 +152,7 @@ export class Overlay implements Printable, Stateful {
167152 * @param point Point to insert.
168153 * @returns Returns the existing point if it was already in the tree.
169154 */
170- protected insertPoint ( point : OverlayPoint ) : OverlayPoint | undefined {
155+ private insPoint ( point : OverlayPoint ) : OverlayPoint | undefined {
171156 let pivot = this . getOrNextLower ( point ) ;
172157 if ( ! pivot ) pivot = first ( this . root ) ;
173158 if ( ! pivot ) {
@@ -183,13 +168,13 @@ export class Overlay implements Printable, Stateful {
183168 return undefined ;
184169 }
185170
186- protected delPoint ( point : OverlayPoint ) : void {
171+ private delPoint ( point : OverlayPoint ) : void {
187172 this . root = remove ( this . root , point ) ;
188173 }
189174
190- protected insSplit ( slice : MarkerSlice ) : [ start : OverlayPoint , end : OverlayPoint ] {
175+ private insMarker ( slice : MarkerSlice ) : [ start : OverlayPoint , end : OverlayPoint ] {
191176 const point = this . markerPoint ( slice , Anchor . Before ) ;
192- const pivot = this . insertPoint ( point ) ;
177+ const pivot = this . insPoint ( point ) ;
193178 if ( ! pivot ) {
194179 point . refs . push ( slice ) ;
195180 const prevPoint = prev ( point ) ;
@@ -199,7 +184,7 @@ export class Overlay implements Printable, Stateful {
199184 }
200185
201186 private insSlice ( slice : Slice ) : [ start : OverlayPoint , end : OverlayPoint ] {
202- if ( slice instanceof MarkerSlice ) return this . insSplit ( slice ) ;
187+ if ( slice instanceof MarkerSlice ) return this . insMarker ( slice ) ;
203188 const txt = this . txt ;
204189 const str = txt . str ;
205190 let startPoint = slice . start ;
0 commit comments