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

Method snapOutOfImageRef

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

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

Callers 3

deleteWordBeforeMethod · 0.95
deleteWordAfterMethod · 0.95
getOperatorRangeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected