From b1222e7b8dcd640e9d4daf6485cc1c5b04e5ed81 Mon Sep 17 00:00:00 2001 From: Woohyuck Jeong Date: Thu, 15 Oct 2026 14:26:43 +0900 Subject: [PATCH] fix: keep the plus key in macOS shortcut labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit normalizeShortcutLabel stripped every "+", including the key itself, so "Shift+Num +" (zoom in) rendered as "⇧" and "Ctrl+Num +" (level decrease) as "⌘". Only strip a "+" that joins two keys. Verified with the studio-host vitest suite (160 passed) and tsc. --- apps/studio-host/src/core/desktop-chrome.test.ts | 6 ++++++ apps/studio-host/src/core/platform.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/studio-host/src/core/desktop-chrome.test.ts b/apps/studio-host/src/core/desktop-chrome.test.ts index 27861d2..1d73c79 100644 --- a/apps/studio-host/src/core/desktop-chrome.test.ts +++ b/apps/studio-host/src/core/desktop-chrome.test.ts @@ -8,6 +8,12 @@ describe('desktop-chrome', () => { expect(normalizeDesktopChromeTitle('찾기 (Ctrl+F)', 'macos')).toBe('찾기 (⌘F)'); }); + it('keeps the plus key in macOS shortcut labels', () => { + expect(normalizeShortcutLabel('Shift+Num +', 'macos')).toBe('⇧+'); + expect(normalizeShortcutLabel('Ctrl+Num +', 'macos')).toBe('⌘+'); + expect(normalizeShortcutLabel('Shift+Num -', 'macos')).toBe('⇧-'); + }); + it('does not rewrite non-shortcut tooltips', () => { expect(normalizeDesktopChromeTitle('줄 간격 증가 (+5%)', 'macos')).toBe('줄 간격 증가 (+5%)'); expect(normalizeDesktopChromeTitle('파일 이름 + 쪽 번호', 'macos')).toBe('파일 이름 + 쪽 번호'); diff --git a/apps/studio-host/src/core/platform.ts b/apps/studio-host/src/core/platform.ts index 5725233..bbfcce1 100644 --- a/apps/studio-host/src/core/platform.ts +++ b/apps/studio-host/src/core/platform.ts @@ -57,7 +57,7 @@ export function normalizeShortcutLabel( .replace(/\bOption\b/gi, '⌥') .replace(/\bShift\b/gi, '⇧') .replace(/\bNum\s+/gi, '') - .replace(/\+/g, '') + .replace(/\+(?![\s,)]|$)/g, '') .replace(/,\s*/g, ' '); }