fix: address PR 49 CodeRabbit follow-ups

This commit is contained in:
2026-04-11 12:10:12 -07:00
parent 953f4c362b
commit d16ed7d879
4 changed files with 75 additions and 2 deletions

View File

@@ -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
<!-- SECTION:DESCRIPTION:BEGIN -->
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.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #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.
<!-- AC:END -->

View File

@@ -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'

View File

@@ -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();

View File

@@ -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;
}
}