MCPcopy Index your code
hub / github.com/codeaashu/claude-code / snapOutOfImageRef

Method snapOutOfImageRef

src/utils/Cursor.ts:340–351  ·  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

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

Callers 3

deleteWordBeforeMethod · 0.95
deleteWordAfterMethod · 0.95
getOperatorRangeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected