fix(keybindings): AltGr-safe default for Add Review Note (#9257)
* fix(keybindings): use AltGr-safe default for Add Review Note The editor.addReviewNote default was Mod+Alt+N, which resolves to Ctrl+Alt+N (AltGr) on Windows/Linux. On diacritic layouts AltGr+N types a real character (e.g. Polish n-acute), so the editor-scope chord hijacked normal typing. Switch the default to Mod+Shift+A, which is AltGr-safe and keeps a mnemonic (A for annotate). * test(keybindings): cover Add Review Note chord end to end
This commit is contained in:
@@ -216,12 +216,40 @@ describe('keybindings', () => {
|
||||
|
||||
it('defines a default shortcut for adding an editor review note', () => {
|
||||
expect(getEffectiveKeybindingsForAction('editor.addReviewNote', 'darwin')).toEqual([
|
||||
'Mod+Alt+N'
|
||||
'Mod+Shift+A'
|
||||
])
|
||||
expect(getEffectiveKeybindingsForAction('editor.addReviewNote', 'linux')).toEqual(['Mod+Alt+N'])
|
||||
expect(getEffectiveKeybindingsForAction('editor.addReviewNote', 'win32')).toEqual(['Mod+Alt+N'])
|
||||
expect(formatKeybindingList(['Mod+Alt+N'], 'darwin')).toBe('⌘⌥N')
|
||||
expect(formatKeybindingList(['Mod+Alt+N'], 'linux')).toBe('Ctrl+Alt+N')
|
||||
expect(getEffectiveKeybindingsForAction('editor.addReviewNote', 'linux')).toEqual([
|
||||
'Mod+Shift+A'
|
||||
])
|
||||
expect(getEffectiveKeybindingsForAction('editor.addReviewNote', 'win32')).toEqual([
|
||||
'Mod+Shift+A'
|
||||
])
|
||||
expect(formatKeybindingList(['Mod+Shift+A'], 'darwin')).toBe('⌘⇧A')
|
||||
expect(formatKeybindingList(['Mod+Shift+A'], 'linux')).toBe('Ctrl+Shift+A')
|
||||
|
||||
const macChord = {
|
||||
key: 'a',
|
||||
code: 'KeyA',
|
||||
meta: true,
|
||||
control: false,
|
||||
alt: false,
|
||||
shift: true
|
||||
}
|
||||
const ctrlChord = { ...macChord, meta: false, control: true }
|
||||
expect(keybindingMatchesAction('editor.addReviewNote', macChord, 'darwin')).toBe(true)
|
||||
expect(keybindingMatchesAction('editor.addReviewNote', ctrlChord, 'linux')).toBe(true)
|
||||
expect(keybindingMatchesAction('editor.addReviewNote', ctrlChord, 'win32')).toBe(true)
|
||||
|
||||
const oldCtrlAltChord = {
|
||||
key: 'n',
|
||||
code: 'KeyN',
|
||||
meta: false,
|
||||
control: true,
|
||||
alt: true,
|
||||
shift: false
|
||||
}
|
||||
expect(keybindingMatchesAction('editor.addReviewNote', oldCtrlAltChord, 'linux')).toBe(false)
|
||||
expect(keybindingMatchesAction('editor.addReviewNote', oldCtrlAltChord, 'win32')).toBe(false)
|
||||
})
|
||||
|
||||
it('defines platform-native replace-in-editor shortcuts', () => {
|
||||
|
||||
@@ -865,7 +865,9 @@ export const KEYBINDING_DEFINITIONS: readonly KeybindingDefinition[] = [
|
||||
group: 'Editors',
|
||||
scope: 'editor',
|
||||
searchKeywords: ['shortcut', 'editor', 'markdown', 'note', 'comment', 'annotation', 'review'],
|
||||
defaultBindings: platformBindings(['Mod+Alt+N'])
|
||||
// Why: Ctrl+Alt+letter is AltGr text input on Windows/Linux; an editor-scope
|
||||
// default must not reserve characters such as Polish `ń`.
|
||||
defaultBindings: platformBindings(['Mod+Shift+A'])
|
||||
},
|
||||
{
|
||||
id: 'fileExplorer.undo',
|
||||
|
||||
Reference in New Issue
Block a user