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

Function parseMouseEvent

src/ink/parse-keypress.ts:594–609  ·  view source on GitHub ↗

* Parse an SGR mouse event sequence into a ParsedMouse, or null if not a * mouse event or if it's a wheel event (wheel stays as ParsedKey for the * keybinding system). Button bit 0x40 = wheel, bit 0x20 = drag/motion.

(s: string)

Source from the content-addressed store, hash-verified

592 * keybinding system). Button bit 0x40 = wheel, bit 0x20 = drag/motion.
593 */
594function parseMouseEvent(s: string): ParsedMouse | null {
595 const match = SGR_MOUSE_RE.exec(s)
596 if (!match) return null
597 const button = parseInt(match[1]!, 10)
598 // Wheel events (bit 6 set, low bits 0/1 for up/down) stay as ParsedKey
599 // so the keybinding system can route them to scroll handlers.
600 if ((button & 0x40) !== 0) return null
601 return {
602 kind: 'mouse',
603 button,
604 action: match[4] === 'M' ? 'press' : 'release',
605 col: parseInt(match[2]!, 10),
606 row: parseInt(match[3]!, 10),
607 sequence: s,
608 }
609}
610
611function parseKeypress(s: string = ''): ParsedKey {
612 let parts

Callers 1

parseMultipleKeypressesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected