MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / snapOutOfImageRef

Method snapOutOfImageRef

source code/utils/Cursor.ts:342–353  ·  view source on GitHub ↗

* 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')

Source from the content-addressed store, hash-verified

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()

Callers 3

deleteWordBeforeMethod · 0.95
deleteWordAfterMethod · 0.95
getOperatorRangeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected