@@ -237,6 +237,12 @@ export class Point implements Pick<Stateful, 'refresh'>, Printable {
237237 return ;
238238 }
239239
240+ /**
241+ * Returns one character to the left of the point, or `undefined` if there
242+ * is no such character. Skips any deleted characters. Handles absolute points.
243+ *
244+ * @returns A character slice to the left of the point.
245+ */
240246 public leftChar ( ) : ChunkSlice | undefined {
241247 const str = this . txt . str ;
242248 if ( this . isAbsEnd ( ) ) {
@@ -253,6 +259,12 @@ export class Point implements Pick<Stateful, 'refresh'>, Printable {
253259 return new ChunkSlice ( chunk , off , 1 ) ;
254260 }
255261
262+ /**
263+ * Returns one character to the right of the point, or `undefined` if there
264+ * is no such character. Skips any deleted characters. Handles absolute points.
265+ *
266+ * @returns A character slice to the right of the point.
267+ */
256268 public rightChar ( ) : ChunkSlice | undefined {
257269 const str = this . txt . str ;
258270 if ( this . isAbsStart ( ) ) {
@@ -321,16 +333,6 @@ export class Point implements Pick<Stateful, 'refresh'>, Printable {
321333 return ! ! id && equal ( this . id , id ) ;
322334 }
323335
324- /**
325- * Modifies the location of the point, such that the spatial location remains
326- * and anchor remains the same, but ensures that the point references a
327- * visible (non-deleted) character.
328- */
329- public refVisible ( ) : void {
330- if ( this . anchor === Anchor . Before ) this . refBefore ( ) ;
331- else this . refAfter ( ) ;
332- }
333-
334336 /**
335337 * Sets the point to the absolute start of the string.
336338 */
@@ -415,6 +417,16 @@ export class Point implements Pick<Stateful, 'refresh'>, Printable {
415417 this . id = this . prevId ( ) || this . txt . str . id ;
416418 }
417419
420+ /**
421+ * Modifies the location of the point, such that the spatial location remains
422+ * the same and tries to preserve anchor location, but ensures that the point
423+ * references a visible (not deleted) character.
424+ */
425+ public refVisible ( ) : void {
426+ if ( this . anchor === Anchor . Before ) this . refBefore ( ) ;
427+ else this . refAfter ( ) ;
428+ }
429+
418430 /**
419431 * Moves point past given number of visible characters. Accepts positive
420432 * and negative distances.
0 commit comments