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

Function parseMouseEvent

source code/ink/parse-keypress.ts:596–611  ·  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

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

Callers 1

parseMultipleKeypressesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected