Support command/ctrl/alt backspace correctly (#17175)

This commit is contained in:
Tommaso Sciortino
2026-01-21 10:13:26 -08:00
committed by GitHub
parent e894871afc
commit f190b87223
27 changed files with 487 additions and 298 deletions

View File

@@ -154,9 +154,10 @@ function formatBindings(bindings: readonly KeyBinding[]): string[] {
function formatBinding(binding: KeyBinding): string {
const modifiers: string[] = [];
if (binding.ctrl) modifiers.push('Ctrl');
if (binding.command) modifiers.push('Cmd');
if (binding.shift) modifiers.push('Shift');
if (binding.alt) modifiers.push('Alt');
if (binding.ctrl) modifiers.push('Ctrl');
if (binding.cmd) modifiers.push('Cmd');
const keyName = formatKeyName(binding.key);
if (!keyName) {
@@ -167,12 +168,13 @@ function formatBinding(binding: KeyBinding): string {
let combo = segments.join(' + ');
const restrictions: string[] = [];
if (binding.ctrl === false) restrictions.push('no Ctrl');
if (binding.shift === false) restrictions.push('no Shift');
if (binding.command === false) restrictions.push('no Cmd');
if (binding.shift === false) restrictions.push('Shift');
if (binding.alt === false) restrictions.push('Alt');
if (binding.ctrl === false) restrictions.push('Ctrl');
if (binding.cmd === false) restrictions.push('Cmd');
if (restrictions.length > 0) {
combo = `${combo} (${restrictions.join(', ')})`;
combo = `${combo} (no ${restrictions.join(', ')})`;
}
return combo ? `\`${combo}\`` : '';