* If offset lands strictly inside an [Image #N] chip, snap it to the given * boundary. Used by word-movement methods so Ctrl+W / Alt+D never leave a * partial chip.
(offset: number, toward: 'start' | 'end')
| 340 | * partial chip. |
| 341 | */ |
| 342 | snapOutOfImageRef(offset: number, toward: 'start' | 'end'): number { |
| 343 | const re = /\[Image #\d+\]/g |
| 344 | let m |
| 345 | while ((m = re.exec(this.text)) !== null) { |
| 346 | const start = m.index |
| 347 | const end = start + m[0].length |
| 348 | if (offset > start && offset < end) { |
| 349 | return toward === 'start' ? start : end |
| 350 | } |
| 351 | } |
| 352 | return offset |
| 353 | } |
| 354 | |
| 355 | up(): Cursor { |
| 356 | const { line, column } = this.getPosition() |
no outgoing calls
no test coverage detected