fix(overlay): send session help commands before closing the modal

- Closing help first could destroy the dedicated modal window on Linux/Windows, dropping the IPC for the selected command
- dispatchConfiguredMpvCommand now returns a promise so help closes only after subtitle seek + re-pause are sent
- Add test asserting IPC order for a paused subtitle seek
This commit is contained in:
sudacode committed 2026-09-29 20:22:01 -07:00
1 parent 0bbd8617f4
commit e49b5f6589
4 files changed
+59 -22

No files matched your search

+4 -3
View File
@@ -7,6 +7,7 @@ function isSubtitleSeekCommand(command: MpvCommand): command is [string, number]
/**
* Sends a configured mpv command. Subtitle seeks re-pause afterwards unless playback
* is known to be running, so stepping lines from a paused video stays paused.
* Resolves once every command has been sent; it never rejects.
*/
export function dispatchConfiguredMpvCommand(
command: MpvCommand,
@@ -14,14 +15,14 @@ export function dispatchConfiguredMpvCommand(
getPlaybackPaused: () => Promise<boolean | null>;
sendMpvCommand: (command: MpvCommand) => void;
},
): void {
): Promise<void> {
if (!isSubtitleSeekCommand(command)) {
deps.sendMpvCommand(command);
return;
return Promise.resolve();
}
// The fallback only covers a failed pause lookup, so a failed re-pause never resends the seek.
void deps
return deps
.getPlaybackPaused()
.then(
(paused) => {