Skip to content

feat: show the source on the video instead of the translation - #105

Merged
xAlcahest merged 1 commit into
mainfrom
source-on-video
Sep 6, 2026
Merged

feat: show the source on the video instead of the translation#105
xAlcahest merged 1 commit into
mainfrom
source-on-video

Conversation

@xAlcahest

Copy link
Copy Markdown
Owner

Summary

The third slice of M2.6, decision 7's second half: the frame draws the translation, and View's new Source on video draws the document being read instead. The first half landed on 2026-09-03, when mpv started reading a shadow copy from Sublore's own cache; this changes which of the two open documents that shadow is written from and nothing else, so neither file on disk is touched and no backup is made by toggling.

SubtitleState::drawn_slot is the only way out of the subtitle module to the source and it is named for drawing, so nothing reaches for it in order to write. It hands back the translation whenever the toggle is on with no source open: a toggle left on when the source closes must not leave an empty frame.

The check reads the length of the line mpv reports at the playhead, which is what preview.spec.js already asserts against. Both fixtures' first cues start at zero, so the playhead is inside each of them and the length is the whole of what changes: 21 characters of the edited translation, 34 of the source, and back.

Changes

  • src-tauri/src/preview/mod.rs: a second flag beside shown, preview_set_source, and a refresh that asks which document to read.
  • src-tauri/src/subtitle/mod.rs: drawn_slot, which answers with the source only while there is one.
  • src-tauri/src/lib.rs: the command registered.
  • src/hooks/usePreview.ts: the toggle's state, sent on mount like the other one so the two ends cannot drift.
  • src/App.tsx: the View command, greyed with no source open.
  • src/i18n/en.ts: the item's words.
  • e2e/specs/preview.spec.js: the toggle, greyed and then alive, and the line on the frame changing from one document to the other and back.
  • e2e/specs/command-registry.spec.js: the command in the declared list.
  • e2e/wdio.conf.js: the count the guard holds.
  • BACKLOG.md: N36 folded into N40, which is the same defect filed twice this morning.

How to verify it by using the app

  1. Open a video, then open a subtitle over it. The lines are on the picture, as before.
  2. Open View. Source on video is drawn and greyed, because there is no second document.
  3. File, Open source subtitle, and pick another subtitle whose lines cover the same moment.
  4. Open View again. Source on video is alive now. Choose it.
  5. The picture shows the source's line instead of the translation's. Choose it again and the translation comes back.
  6. Neither file on disk changed, and no backup of either was made: what mpv reads is Sublore's own copy in its cache.
  7. Close the source while the toggle is still on. The picture goes back to the translation rather than going blank.

Verified on Linux: full gate green step by step, and the battery green at 35 spec files of 35 with 288 checks. One mutation, a drawn_slot that always answers with the translation, reddened this check and only this one.

@xAlcahest
xAlcahest merged commit 81ff369 into main Sep 6, 2026
14 checks passed
@xAlcahest
xAlcahest deleted the source-on-video branch September 6, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant