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

Function decodeModifier

source code/ink/parse-keypress.ts:467–480  ·  view source on GitHub ↗

* Decode XTerm-style modifier value to individual flags. * Modifier encoding: 1 + (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0) + (super ? 8 : 0) * * Note: `meta` here means Alt/Option (bit 2). `super` is a distinct * modifier (bit 8, i.e. Cmd on macOS / Win key). Most legacy terminal * sequ

(modifier: number)

Source from the content-addressed store, hash-verified

465 * protocol (CSI u) or xterm modifyOtherKeys.
466 */
467function decodeModifier(modifier: number): {
468 shift: boolean
469 meta: boolean
470 ctrl: boolean
471 super: boolean
472} {
473 const m = modifier - 1
474 return {
475 shift: !!(m & 1),
476 meta: !!(m & 2),
477 ctrl: !!(m & 4),
478 super: !!(m & 8),
479 }
480}
481
482/**
483 * Map keycode to key name for modifyOtherKeys/CSI u sequences.

Callers 1

parseKeypressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected