Change control modifier to regular ASCII caret

This commit is contained in:
Jonathan Tran
2024-08-22 21:38:52 -04:00
parent 95b8ce895f
commit c4ec86700b
2 changed files with 9 additions and 6 deletions

View File

@ -22,12 +22,13 @@ describe('hotkeyDisplay', () => {
expect(hotkeyDisplay('alt+c', 'linux')).toEqual('Alt+C')
})
it('displays ctrl', async () => {
expect(hotkeyDisplay('ctrl+c', 'macos')).toEqual('C')
expect(hotkeyDisplay('ctrl+c', 'macos')).toEqual('^C')
expect(hotkeyDisplay('ctrl+c', 'windows')).toEqual('Ctrl+C')
expect(hotkeyDisplay('ctrl+c', 'linux')).toEqual('Ctrl+C')
})
it('displays multiple modifiers', async () => {
expect(hotkeyDisplay('shift+alt+ctrl+c', 'windows')).toEqual('Shift+Alt+Ctrl+C')
expect(hotkeyDisplay('shift+alt+ctrl+c', 'windows')).toEqual(
'Shift+Alt+Ctrl+C'
)
})
})

View File

@ -68,9 +68,11 @@ export function hotkeyDisplay(hotkey: string, platform: Platform): string {
.replaceAll(WHITESPACE, ' ')
.replaceAll('mod', isMac ? '⌘' : 'Ctrl')
.replaceAll('meta', isMac ? '⌘' : meta)
// Note: This is *not* the ASCII caret character. It's "UP ARROWHEAD".
// Unicode: U+2303.
.replaceAll('ctrl', isMac ? '⌃' : 'Ctrl')
// This is technically the wrong arrow for control, but it's more visible
// and recognizable. May want to change this in the future.
//
// The correct arrow is ⌃ "UP ARROWHEAD" Unicode: U+2303
.replaceAll('ctrl', isMac ? '^' : 'Ctrl')
// This is technically the wrong arrow for shift, but it's more visible and
// recognizable. May want to change this in the future.
//