Skip to content

fix: resume the teleprompter where it was paused - #2461

Open
AatmanAJ wants to merge 1 commit into
CapSoftware:mainfrom
AatmanAJ:fix/teleprompter-resume-position
Open

AatmanAJ wants to merge 1 commit into
CapSoftware:mainfrom
AatmanAJ:fix/teleprompter-resume-position

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2081

In the Tauri teleprompter, pressing play after a pause jumped back to the start of the script.

Cause

togglePlayback first calls resizeEditor(), which sizes the script editor to fit its text: it sets the textarea to 0px and reads scrollHeight.

  1. Reading scrollHeight forces a layout while the textarea is 0px tall.
  2. In that layout the scroller only contains its two spacers, which together are shorter than its viewport.
  3. So the browser clamps scrollTop to 0.
  4. Restoring the height doesn't bring the old position back, and playbackPosition = element.scrollTop then reads 0.

Any editor resize while paused had the same effect, including typing, changing the font size, and resizing the window. The first play was unaffected only because scrollTop was already 0.

Fix

  • resizeEditor now keeps the scroller's scrollTop across that measurement, using a small preserveScrollTop helper in teleprompter-utils.ts.
  • The GPUI teleprompter already resumes from its live scroll offset, so its behaviour doesn't change. That decision is now a pure playback_resume_position with a test, to keep the shipping app correct.
  • Pausing the teleprompter when the recording pauses, the issue's second request, already works in both apps.

Testing

  • Tauri: three preserveScrollTop tests use a fake scroller that clamps scrollTop the way a browser does when its content shrinks. One of them fails if the helper doesn't restore the position. All 12 teleprompter-utils tests pass, along with Biome and tsc -p apps/desktop --noEmit.
  • GPUI: playback_resumes_where_it_was_paused fails if resuming always restarts from the top. cargo test --bin cap-gpui passes 1076 tests, and clippy reports nothing in teleprompter_window.rs.
  • Hand-tested on macOS 27.0.1, with Play, then Pause after the script has scrolled, then Play again:
    • Cap 0.6.0: jumps back to the top.
    • Tauri dev app on this branch: continues from where it paused.
    • GPUI app: continues from where it paused.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Keeps the Tauri teleprompter’s scroll position while resizing its script editor, so playback can continue where it paused.

  • The Tauri teleprompter keeps its place when the editor resizes.
  • GPUI playback resumes from the script’s current scroll position.

Reviews (1) · Last reviewed commit: "fix(teleprompter): resume playback where..." · Reviewed by Greptile

In the Tauri teleprompter, pressing play after a pause jumped back to the
start of the script. togglePlayback first calls resizeEditor, which sets
the auto-sized script editor to 0px and reads scrollHeight. That forced
layout makes the scroller's content shorter than its viewport, so the
browser clamps scrollTop to 0, and restoring the height does not bring
it back. Playback then started from the 0 it read. The same reset
happened whenever the editor resized while paused (typing, font size,
window resize).

Keep the scroller's scrollTop across that measurement.

The GPUI teleprompter already resumes from its live scroll offset. Pull
that decision into playback_resume_position and test it, so the shipping
app keeps this behaviour.

Fixes CapSoftware#2081
@AatmanAJ
AatmanAJ marked this pull request as ready for review October 11, 2026 09:03

This branch has not been deployed

No deployments
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.

Teleprompter loses position when resuming

1 participant