2.8 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, priority, ordinal
| id | title | status | assignee | created_date | updated_date | labels | dependencies | priority | ordinal | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TASK-98 | Add mpv OSD hovered-token highlighting from Electron token state | Done | 2026-02-21 23:16 | 2026-02-22 07:49 |
|
high | 81000 |
Description
Implement hovered-token highlighting in mpv subtitle OSD by reusing token/hover state that already exists in Electron overlays. When pointer hovers a token in overlay, propagate hovered token identity to mpv subtitle rendering path so the corresponding mpv subtitle token is color-highlighted consistently.
Suggestions
- Extend Electron->main IPC hover payload to include stable token index/id usable by mpv renderer.
- Keep mpv highlight style configurable through existing subtitle style settings where possible.
- Reset mpv highlight state on subtitle changes and hover leave events.
Action Steps
- Identify current overlay hover event source and token identity payload shape.
- Extend main runtime message path to carry hovered token to mpv OSD renderer service.
- Update mpv subtitle ASS rendering to apply hover color override to matching token span.
- Add regression tests for hover enter/move/leave and subtitle replacement edge cases.
- Verify behavior in plugin flow (
--texthooker->--start) and normal overlay mode.
Acceptance Criteria
- #1 Hovering a token in Electron overlay highlights corresponding token in mpv subtitle OSD.
- #2 Hover leave (or subtitle switch) clears mpv hovered-token highlight reliably.
- #3 No regressions in existing token color annotations (known/N+1/frequency/JLPT).
- #4 Automated tests cover hover payload propagation + mpv rendering highlight behavior.
Final Summary
Implemented invisible-overlay-only hovered token highlighting in mpv using a dedicated osd-overlay ASS layer. Renderer now tags token spans with stable token indices and reports hover index changes (subtitle-token-hover:set) through preload IPC. Main caches latest tokenized subtitle payload, tracks hovered token index, and pushes/clears ASS highlight overlay via new runtime helper src/main/runtime/mpv-hover-highlight.ts. Added regression tests for ASS/command generation and IPC dependency wiring. Validation: bun run build, node --test dist/main/runtime/mpv-hover-highlight.test.js dist/core/services/ipc.test.js, node --test dist/renderer/subtitle-render.test.js.
Definition of Done
- #1 Relevant unit/integration tests pass
- #2 Docs/config notes updated for any new setting or payload contract