Repository navigation
Description
Problem
Every editor operation that changes a sentence's text rebuilds the whole sentence from scratch. That includes editing the sentence, editing a paragraph, and Find & Replace. The rebuilt sentence gets fresh words from respread (core/src/editor.ts), so even words the reviewer didn't touch lose two things:
- Their native timing.
respreadspreads the new words over the sentence's time span in proportion to their character length. After any edit, the karaoke cursor and click-to-seek drift across the whole sentence, not just at the edited word. This predates Disclaimer follows speaker labels; vocabulary file applied after transcription #26. - The record of what the model wrote. Disclaimer follows speaker labels; vocabulary file applied after transcription #26 adds
originaltoWord,FlatWordandEditorWord, so a word the vocabulary file replaced keeps what the model wrote, and that record is saved with the draft. A rebuilt sentence has nooriginalon any word. So a Find & Replace of "Tuesday" also erases the record that "Shivaun" was "Siobhan" in the model's output, if both are in one sentence.
Find & Replace makes this especially easy to hit: any match anywhere in a sentence rebuilds all of it (replaceAll → respread).
Proposal
When an operation changes a sentence's text, compare the old and new word lists (a word-level diff or alignment) and:
- keep unchanged words as they are: their object,
start/end,speakerandoriginal; - re-time only the inserted or changed runs, spreading each across the time between its kept neighbours;
- decide what an edited vocabulary word shows, for example keep
originalso the audit trail reads "model: Siobhan → vocabulary: Shivaun → reviewer: Siobhán", or drop it.
The third point belongs with the vocabulary underline step (suggestion UX "D" in docs/research/voice2text-lessons-2026-11.md §3), which needs a clickable prototype first under the project's prototype-first rule.
Where
core/src/editor.ts:respread,editSentence,editParagraph,replaceAll(and checkjoinSentences/splitSentence, which slice words and so already keep them).core/src/types.ts:EditorWord.original(from Disclaimer follows speaker labels; vocabulary file applied after transcription #26).
Tests to agree before building
Through the public editor operations, with literal transcripts:
- Find & Replace of one word leaves every other word in the sentence with its original
start/endandoriginal. editSentencethat changes one word re-times only that word, within its neighbours' gap.- An edit that inserts a word places it between its neighbours' times.
Context
- This came out of the quiz on Disclaimer follows speaker labels; vocabulary file applied after transcription #26, where Codex's review finding (original not saved) was fixed. That fix made the loss on edit visible.
- Related: Disclaimer follows speaker labels; vocabulary file applied after transcription #26 (vocabulary step one) and docs: full Mac bench grid — segmentation, beam search, seven models #27 (word timings constrain the model choice, because the editor is karaoke-style).
Activity
refactor(core): simplify the #28 retime and stop re-timing on the liv…