Skip to content

Commit

Permalink
Merge pull request #98815 from microsoft/lszomoru/screencast-label
Browse files Browse the repository at this point in the history
Keybinding - Do not push an empty string to the result
  • Loading branch information
alexdima authored Jun 1, 2020
2 parents 1cfe31d + 918bf38 commit 8a6c086
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 32 deletions.
4 changes: 3 additions & 1 deletion src/vs/base/common/keybindingLabels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabe
}

// the actual key
result.push(key);
if (key !== '') {
result.push(key);
}

return result.join(labels.separator);
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,7 @@ suite('KeybindingLabels', () => {
assertElectronAcceleratorLabel(OperatingSystem.Macintosh, KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_A, KeyMod.CtrlCmd | KeyCode.KEY_B), 'cmd+a cmd+b');
});

test('issue #91235: Do not end with a +', () => {
assertUSLabel(OperatingSystem.Windows, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Alt, 'Ctrl+Alt');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ suite('keyboardMapper - MAC fallback', () => {
},
{
label: '⌘',
ariaLabel: 'Command+',
ariaLabel: 'Command',
electronAccelerator: null,
userSettingsLabel: 'cmd+',
userSettingsLabel: 'cmd',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down Expand Up @@ -228,10 +228,10 @@ suite('keyboardMapper - LINUX fallback', () => {
code: null!
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ suite('keyboardMapper - MAC de_ch', () => {
},
{
label: '⌘',
ariaLabel: 'Command+',
ariaLabel: 'Command',
electronAccelerator: null,
userSettingsLabel: 'cmd+',
userSettingsLabel: 'cmd',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand All @@ -368,9 +368,9 @@ suite('keyboardMapper - MAC de_ch', () => {
},
{
label: '⌘',
ariaLabel: 'Command+',
ariaLabel: 'Command',
electronAccelerator: null,
userSettingsLabel: 'cmd+',
userSettingsLabel: 'cmd',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down Expand Up @@ -425,9 +425,9 @@ suite('keyboardMapper - MAC en_us', () => {
},
{
label: '⌘',
ariaLabel: 'Command+',
ariaLabel: 'Command',
electronAccelerator: null,
userSettingsLabel: 'cmd+',
userSettingsLabel: 'cmd',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand All @@ -449,9 +449,9 @@ suite('keyboardMapper - MAC en_us', () => {
},
{
label: '⌘',
ariaLabel: 'Command+',
ariaLabel: 'Command',
electronAccelerator: null,
userSettingsLabel: 'cmd+',
userSettingsLabel: 'cmd',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down Expand Up @@ -780,10 +780,10 @@ suite('keyboardMapper - LINUX de_ch', () => {
code: 'ControlLeft'
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand All @@ -804,10 +804,10 @@ suite('keyboardMapper - LINUX de_ch', () => {
code: 'ControlRight'
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down Expand Up @@ -1180,10 +1180,10 @@ suite('keyboardMapper - LINUX en_us', () => {
code: 'ControlLeft'
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand All @@ -1204,10 +1204,10 @@ suite('keyboardMapper - LINUX en_us', () => {
code: 'ControlRight'
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
code: null!
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down Expand Up @@ -396,10 +396,10 @@ suite('keyboardMapper - WINDOWS en_us', () => {
code: null!
},
{
label: 'Ctrl+',
ariaLabel: 'Control+',
label: 'Ctrl',
ariaLabel: 'Control',
electronAccelerator: null,
userSettingsLabel: 'ctrl+',
userSettingsLabel: 'ctrl',
isWYSIWYG: true,
isChord: false,
dispatchParts: [null],
Expand Down

0 comments on commit 8a6c086

Please sign in to comment.