* 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')
| 313 | * partial chip. |
| 314 | */ |
| 315 | snapOutOfImageRef(offset: number, toward: 'start' | 'end'): number { |
| 316 | const re = /\[Image #\d+\]/g |
| 317 | let m |
| 318 | while ((m = re.exec(this.text)) !== null) { |
| 319 | const start = m.index |
| 320 | const end = start + m[0].length |
| 321 | if (offset > start && offset < end) { |
| 322 | return toward === 'start' ? start : end |
| 323 | } |
| 324 | } |
| 325 | return offset |
| 326 | } |
| 327 | |
| 328 | up(): Cursor { |
| 329 | const { line, column } = this.getPosition() |
no outgoing calls
no test coverage detected