mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 01:57:57 +00:00
fix(keybindings): show ⇧ for Shift in Windows/Linux shortcut labels (#35754)
* fix(keybindings): show the ⇧ glyph for Shift on Windows and Linux Spelled-out Shift made non-mac shortcut labels long (Ctrl+Shift+Backspace). * test(menu): expect the ⇧ glyph in non-mac app menu hints; align double-tap hint
This commit is contained in:
@@ -53,7 +53,7 @@ describe('keybindings', () => {
|
||||
'Mod+Shift+A'
|
||||
])
|
||||
expect(formatKeybindingList(['Mod+Shift+A'], 'darwin')).toBe('⌘⇧A')
|
||||
expect(formatKeybindingList(['Mod+Shift+A'], 'linux')).toBe('Ctrl+Shift+A')
|
||||
expect(formatKeybindingList(['Mod+Shift+A'], 'linux')).toBe('Ctrl+⇧+A')
|
||||
|
||||
const macChord = {
|
||||
key: 'a',
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('keybindings', () => {
|
||||
|
||||
it('formats double-tap bindings as the modifier glyph twice', () => {
|
||||
expect(formatKeybinding('DoubleTap+Shift', 'darwin')).toEqual(['⇧', '⇧'])
|
||||
expect(formatKeybinding('DoubleTap+Shift', 'linux')).toEqual(['Shift', 'Shift'])
|
||||
expect(formatKeybinding('DoubleTap+Shift', 'linux')).toEqual(['⇧', '⇧'])
|
||||
expect(formatKeybinding('DoubleTap+Mod', 'darwin')).toEqual(['⌘', '⌘'])
|
||||
expect(formatKeybinding('DoubleTap+Mod', 'win32')).toEqual(['Ctrl', 'Ctrl'])
|
||||
expect(formatKeybinding('DoubleTap+Cmd', 'win32')).toEqual(['Cmd', 'Cmd'])
|
||||
@@ -119,7 +119,7 @@ describe('keybindings', () => {
|
||||
// Ctrl's glyph ⌃ diverges from Mod's ⌘ on Mac, so cover it explicitly.
|
||||
expect(formatKeybinding('DoubleTap+Ctrl', 'darwin')).toEqual(['⌃', '⌃'])
|
||||
expect(formatKeybindingList(['DoubleTap+Shift'], 'darwin')).toBe('⇧ ⇧')
|
||||
expect(formatKeybindingList(['DoubleTap+Shift'], 'linux')).toBe('Shift Shift')
|
||||
expect(formatKeybindingList(['DoubleTap+Shift'], 'linux')).toBe('⇧ ⇧')
|
||||
})
|
||||
|
||||
it('reports conflicts across two double-tap bindings', () => {
|
||||
|
||||
@@ -169,9 +169,9 @@ describe('keybindings', () => {
|
||||
|
||||
it('formats keybindings with platform labels', () => {
|
||||
expect(formatKeybindingList(['Mod+Shift+J'], 'darwin')).toBe('⌘⇧J')
|
||||
expect(formatKeybindingList(['Mod+Shift+J'], 'linux')).toBe('Ctrl+Shift+J')
|
||||
expect(formatKeybindingList(['Mod+Shift+J'], 'linux')).toBe('Ctrl+⇧+J')
|
||||
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'darwin')).toBe('⌘⇧⌫')
|
||||
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'linux')).toBe('Ctrl+Shift+Backspace')
|
||||
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'linux')).toBe('Ctrl+⇧+Backspace')
|
||||
expect(formatKeybindingList([], 'win32')).toBe('Unassigned')
|
||||
})
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ function formatModifierGlyph(modifier: ModifierToken, isMac: boolean): string {
|
||||
case 'Alt':
|
||||
return isMac ? '⌥' : 'Alt'
|
||||
case 'Shift':
|
||||
return isMac ? '⇧' : 'Shift'
|
||||
return '⇧'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export function formatKeybinding(binding: string, platform: NodeJS.Platform): st
|
||||
parts.push(isMac ? '⌥' : 'Alt')
|
||||
}
|
||||
if (parsed.shift) {
|
||||
parts.push(isMac ? '⇧' : 'Shift')
|
||||
parts.push('⇧')
|
||||
}
|
||||
parts.push(formatKeyToken(parsed.key, isMac))
|
||||
return parts
|
||||
|
||||
Reference in New Issue
Block a user