* 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')
| 338 | * partial chip. |
| 339 | */ |
| 340 | snapOutOfImageRef(offset: number, toward: 'start' | 'end'): number { |
| 341 | const re = /\[Image #\d+\]/g |
| 342 | let m |
| 343 | while ((m = re.exec(this.text)) !== null) { |
| 344 | const start = m.index |
| 345 | const end = start + m[0].length |
| 346 | if (offset > start && offset < end) { |
| 347 | return toward === 'start' ? start : end |
| 348 | } |
| 349 | } |
| 350 | return offset |
| 351 | } |
| 352 | |
| 353 | up(): Cursor { |
| 354 | const { line, column } = this.getPosition() |
no outgoing calls
no test coverage detected