From d16ed7d87908190a460d2f7283cbe61e92403c49 Mon Sep 17 00:00:00 2001 From: sudacode Date: Sat, 11 Apr 2026 12:10:12 -0700 Subject: [PATCH] fix: address PR 49 CodeRabbit follow-ups --- ...ress-PR-49-CodeRabbit-review-follow-ups.md | 34 +++++++++++++++++ .../runtime/config-hot-reload-handlers.ts | 1 + src/renderer/handlers/keyboard.test.ts | 38 +++++++++++++++++++ src/renderer/handlers/keyboard.ts | 4 +- 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 backlog/tasks/task-286 - Assess-and-address-PR-49-CodeRabbit-review-follow-ups.md diff --git a/backlog/tasks/task-286 - Assess-and-address-PR-49-CodeRabbit-review-follow-ups.md b/backlog/tasks/task-286 - Assess-and-address-PR-49-CodeRabbit-review-follow-ups.md new file mode 100644 index 00000000..9b293033 --- /dev/null +++ b/backlog/tasks/task-286 - Assess-and-address-PR-49-CodeRabbit-review-follow-ups.md @@ -0,0 +1,34 @@ +--- +id: TASK-286 +title: 'Assess and address PR #49 CodeRabbit review follow-ups' +status: In Progress +assignee: [] +created_date: '2026-04-11 18:55' +labels: + - bug + - code-review + - windows + - overlay +dependencies: [] +references: + - src/main/runtime/config-hot-reload-handlers.ts + - src/renderer/handlers/keyboard.ts + - src/renderer/handlers/mouse.ts + - vendor/subminer-yomitan +priority: high +--- + +## Description + + +Track the current PR #49 review round and resolve the actionable CodeRabbit findings on the Windows update branch. + +Focus areas include the renderer mouse interaction fix, config hot-reload keyboard state, and any other review items that still apply after verifying the current branch state. + + +## Acceptance Criteria + +- [ ] #1 All actionable CodeRabbit comments on PR #49 are either fixed or shown to be obsolete with evidence. +- [ ] #2 Regression tests are added or updated for any behavior change that could regress. +- [ ] #3 The branch passes the repo's relevant verification checks for the touched areas. + diff --git a/src/main/runtime/config-hot-reload-handlers.ts b/src/main/runtime/config-hot-reload-handlers.ts index f33f7246..0f752943 100644 --- a/src/main/runtime/config-hot-reload-handlers.ts +++ b/src/main/runtime/config-hot-reload-handlers.ts @@ -43,6 +43,7 @@ export function buildConfigHotReloadPayload(config: ResolvedConfig): ConfigHotRe const { bindings: sessionBindings, warnings: sessionBindingWarnings } = compileSessionBindings({ keybindings, shortcuts: resolveConfiguredShortcuts(config, DEFAULT_CONFIG), + statsToggleKey: config.stats.toggleKey, platform: process.platform === 'darwin' ? 'darwin' diff --git a/src/renderer/handlers/keyboard.test.ts b/src/renderer/handlers/keyboard.test.ts index f4935fdb..4971e0c0 100644 --- a/src/renderer/handlers/keyboard.test.ts +++ b/src/renderer/handlers/keyboard.test.ts @@ -723,6 +723,44 @@ test('visible-layer y-t dispatches mpv plugin toggle while overlay owns focus', } }); +test('refreshConfiguredShortcuts updates hot-reloaded stats and watched keys', async () => { + const { ctx, handlers, testGlobals } = createKeyboardHandlerHarness(); + + try { + await handlers.setupMpvInputForwarding(); + + testGlobals.setConfiguredShortcuts({ + copySubtitle: '', + copySubtitleMultiple: '', + updateLastCardFromClipboard: '', + triggerFieldGrouping: '', + triggerSubsync: 'Ctrl+Alt+S', + mineSentence: '', + mineSentenceMultiple: '', + multiCopyTimeoutMs: 3333, + toggleSecondarySub: '', + markAudioCard: '', + openRuntimeOptions: 'CommandOrControl+Shift+O', + openJimaku: 'Ctrl+Shift+J', + openSessionHelp: 'CommandOrControl+Shift+H', + openControllerSelect: 'Alt+C', + openControllerDebug: 'Alt+Shift+C', + toggleSubtitleSidebar: '', + toggleVisibleOverlayGlobal: '', + }); + testGlobals.setStatsToggleKey(''); + testGlobals.setMarkWatchedKey(''); + + await handlers.refreshConfiguredShortcuts(); + + assert.equal(ctx.state.sessionActionTimeoutMs, 3333); + assert.equal(ctx.state.statsToggleKey, ''); + assert.equal(ctx.state.markWatchedKey, ''); + } finally { + testGlobals.restore(); + } +}); + test('keyboard mode: controller helpers dispatch popup audio play/cycle and scroll bridge commands', async () => { const { ctx, handlers, testGlobals } = createKeyboardHandlerHarness(); diff --git a/src/renderer/handlers/keyboard.ts b/src/renderer/handlers/keyboard.ts index 391e82ca..eb161f96 100644 --- a/src/renderer/handlers/keyboard.ts +++ b/src/renderer/handlers/keyboard.ts @@ -86,10 +86,10 @@ export function createKeyboardHandlers( markWatchedKey?: string, ): void { ctx.state.sessionActionTimeoutMs = shortcuts.multiCopyTimeoutMs; - if (typeof statsToggleKey === 'string' && statsToggleKey.length > 0) { + if (typeof statsToggleKey === 'string') { ctx.state.statsToggleKey = statsToggleKey; } - if (typeof markWatchedKey === 'string' && markWatchedKey.length > 0) { + if (typeof markWatchedKey === 'string') { ctx.state.markWatchedKey = markWatchedKey; } }