mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-26 04:46:07 -08:00
fix(overlay): keep forwarding mpv keys after a Yomitan popup closes (#332)
Decide whether the Yomitan popup is open from the popup host in the DOM instead of the cached yomitanPopupVisible flag, which can lag a close and kept input.conf keys from reaching mpv. Keep the imported mpv key list in place while a refresh is in flight, so a key pressed right after the overlay regains focus is not dropped. A failed reload still clears the list. At --log-level debug, log why the overlay kept an mpv-bound key (config-loading, modal, lookup-popup, interactive-target or no-imported-bindings) over a validated IPC channel. Refs #331
This commit is contained in:
1 parent
0c1865f4a6
commit
0ae70b4ab2
14 files changed
+227
-23
No files matched your search
@@ -4,7 +4,7 @@ import test from 'node:test';
|
||||
import { DEFAULT_CONFIG, DEFAULT_KEYBINDINGS } from '../../config/definitions';
|
||||
import { compileSessionBindings } from '../../core/services/session-bindings';
|
||||
import { resolveConfiguredShortcuts } from '../../core/utils/shortcut-config';
|
||||
import { parseSessionActionDispatchRequest } from './validators';
|
||||
import { parseSessionActionDispatchRequest, parseUnforwardedMpvKeyReport } from './validators';
|
||||
|
||||
// Regression guard: SESSION_ACTION_IDS in validators.ts is a hand-maintained mirror of the
|
||||
// SessionActionId union. If a new shortcut-backed action is added to the union/defaults but not to
|
||||
@@ -36,3 +36,13 @@ test('every default session-action binding is accepted by parseSessionActionDisp
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('unforwarded mpv key reports accept known reasons only', () => {
|
||||
assert.deepEqual(parseUnforwardedMpvKeyReport({ key: 'LEFT', reason: 'lookup-popup' }), {
|
||||
key: 'LEFT',
|
||||
reason: 'lookup-popup',
|
||||
});
|
||||
assert.equal(parseUnforwardedMpvKeyReport({ key: 'LEFT', reason: 'toString' }), null);
|
||||
assert.equal(parseUnforwardedMpvKeyReport({ key: '', reason: 'modal' }), null);
|
||||
assert.equal(parseUnforwardedMpvKeyReport(null), null);
|
||||
});
|
||||
Reference in new issue
Block a user