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

Function keystrokeToDisplayString

source code/keybindings/parser.ts:159–178  ·  view source on GitHub ↗
(
  ks: ParsedKeystroke,
  platform: DisplayPlatform = 'linux',
)

Source from the content-addressed store, hash-verified

157 * Uses "opt" for alt on macOS, "alt" elsewhere.
158 */
159export function keystrokeToDisplayString(
160 ks: ParsedKeystroke,
161 platform: DisplayPlatform = 'linux',
162): string {
163 const parts: string[] = []
164 if (ks.ctrl) parts.push('ctrl')
165 // Alt/meta are equivalent in terminals, show platform-appropriate name
166 if (ks.alt || ks.meta) {
167 // Only macOS uses "opt", all other platforms use "alt"
168 parts.push(platform === 'macos' ? 'opt' : 'alt')
169 }
170 if (ks.shift) parts.push('shift')
171 if (ks.super) {
172 parts.push(platform === 'macos' ? 'cmd' : 'super')
173 }
174 // Use readable names for display
175 const displayKey = keyToDisplayName(ks.key)
176 parts.push(displayKey)
177 return parts.join('+')
178}
179
180/**
181 * Convert a Chord to a platform-appropriate display string.

Callers 1

chordToDisplayStringFunction · 0.85

Calls 1

keyToDisplayNameFunction · 0.85

Tested by

no test coverage detected