Skip to content

Editor: keep untouched words (timing and vocabulary original) when a sentence is edited #28

Done

Description

@billlyzhaoyh

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:

  1. Their native timing. respread spreads 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.
  2. The record of what the model wrote. Disclaimer follows speaker labels; vocabulary file applied after transcription #26 adds original to Word, FlatWord and EditorWord, so a word the vocabulary file replaced keeps what the model wrote, and that record is saved with the draft. A rebuilt sentence has no original on 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, speaker and original;
  • 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 original so 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

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/end and original.
  • editSentence that 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

Activity

  1. added
    enhancement
    on Nov 23, 2026
  2. added a commit that references this issue on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions