MCPcopy
hub / github.com/codeaashu/claude-code / chordPrefixMatches

Function chordPrefixMatches

src/keybindings/resolver.ts:123–135  ·  view source on GitHub ↗

* Check if a chord prefix matches the beginning of a binding's chord.

(
  prefix: ParsedKeystroke[],
  binding: ParsedBinding,
)

Source from the content-addressed store, hash-verified

121 * Check if a chord prefix matches the beginning of a binding's chord.
122 */
123function chordPrefixMatches(
124 prefix: ParsedKeystroke[],
125 binding: ParsedBinding,
126): boolean {
127 if (prefix.length >= binding.chord.length) return false
128 for (let i = 0; i < prefix.length; i++) {
129 const prefixKey = prefix[i]
130 const bindingKey = binding.chord[i]
131 if (!prefixKey || !bindingKey) return false
132 if (!keystrokesEqual(prefixKey, bindingKey)) return false
133 }
134 return true
135}
136
137/**
138 * Check if a full chord matches a binding's chord.

Callers 1

resolveKeyWithChordStateFunction · 0.85

Calls 1

keystrokesEqualFunction · 0.85

Tested by

no test coverage detected