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

Function decodeModifier

src/ink/parse-keypress.ts:465–478  ·  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

463 * protocol (CSI u) or xterm modifyOtherKeys.
464 */
465function decodeModifier(modifier: number): {
466 shift: boolean
467 meta: boolean
468 ctrl: boolean
469 super: boolean
470} {
471 const m = modifier - 1
472 return {
473 shift: !!(m & 1),
474 meta: !!(m & 2),
475 ctrl: !!(m & 4),
476 super: !!(m & 8),
477 }
478}
479
480/**
481 * 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