mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 16:46:06 -08:00
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:
4 files changed
+59
-22
No files matched your search
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user