Preserve script line breaks in teleprompter views - #74
Open
justincone wants to merge 1 commit into
Open
Conversation
The word splitter collapsed newlines into spaces, so scripts rendered as one wrapped paragraph. Line and paragraph break positions are now computed per word index (lineBreakIndices) and passed alongside the words array, which stays unchanged so char-offset-based speech tracking, tap-to-jump, and remote sync are unaffected. WordFlowLayout starts a new line at each break and renders paragraph breaks as one blank line of matching height to keep scroll culling uniform. Applies to notch, floating, fullscreen, and external display views, including director mode updates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently
splitTextIntoWordsreplaces newlines with spaces, so a script with intentional line breaks renders as one continuously wrapped paragraph in the overlay.This PR preserves the author's line structure.
lineBreakIndices()computes which word indices are followed by a hard break (and which by a blank line), and passes that alongside the existingwordsarray — which stays byte-identical, so char-offset-based speech tracking, tap-to-jump, and the remote/director sync protocol are unaffected.WordFlowLayoutstarts a new line at each break and renders paragraph breaks as a blank line of exactly one line-height, keeping the visibility-culling math uniform.Applies to the notch overlay, floating window, fullscreen, and external display views, including director-mode live updates. Long lines still word-wrap by width as before. The browser remote view is unchanged (its renderer is separate).
Tested: word-array equivalence and break positions verified against multi-paragraph, whitespace-only-line, consecutive-blank-line, and CJK inputs.