Skip to content

fix(desktop-gpui): keep the timeline position when a new clip reloads the editor - #2664

Open
Zingzy wants to merge 4 commits into
CapSoftware:mainfrom
Zingzy:fix/editor-reload-keeps-timeline
Open

Zingzy wants to merge 4 commits into
CapSoftware:mainfrom
Zingzy:fix/editor-reload-keeps-timeline

Conversation

@Zingzy

@Zingzy Zingzy commented Oct 17, 2026 •

Copy link
Copy Markdown

Recording a new clip into an open project, or importing one from the Clips panel, sends the editor back to the start of the timeline. On a long project you lose your place every time you add a clip.

Cause

append_recorded_clip and the import path both finish with app_windows::reload_editor, which removes the editor window and opens a new one. The new EditorWindow starts with a default TimelineView, and its first render runs fit_on_mount, so the timeline opens at 0:00 like a fresh project. The old window's position and zoom are dropped with it.

Fix

  • reload_editor reads the old window's Transform before removing it and hands it to the new window.
  • The new window applies it at the first render, in place of fit_on_mount, through Transform::restored. That clamps the zoom and position to the new duration with the same update_zoom and set_position the timeline already uses.
  • A view that was never fitted (zoom 0) is ignored and the window fits as before. Restoring it would clamp to MAX_ZOOM_IN.
  • Only reload_editor sets the restore, so every other way of opening an editor is unchanged.
  • The playhead and the sidebar tab still reset on reload. The playhead can only be sought once the playback engine is ready, which is after the first render, so this change keeps to the viewport.

The Tauri app in 0.6.0 behaves the same way. It isn't changed here.

Testing

  • restored_transform_keeps_the_saved_view_and_clamps_to_the_timeline covers the saved view on a longer timeline, clamping to a shorter one, and the unfitted view.
  • cargo test --bin cap-gpui: 1184 passed. cargo fmt --check passes, and cargo clippy --bin cap-gpui --tests reports nothing on the changed lines.
  • Hand-tested in a debug GPUI build on macOS 26.4 (Apple M5) with a 40 s Studio project. I scrolled the timeline to 0:12.5 (17 s visible), opened Clips, chose Record a new clip, recorded the display for a few seconds and stopped:
Build Timeline after the editor reopens
Cap 0.6.0 (Tauri) back to 0:00
GPUI without this change back to 0:00
GPUI with this change stays at 0:12.5, same zoom, new clip appended (0:52 to 1:01)

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Keeps the timeline’s position and zoom when adding a clip reloads the GPUI editor.

  • GPUI clip reloads keep the timeline at its current view.

No actionable issues found. Checks were limited to source inspection; tests and native UI checks were not run.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/editor-relo..." · Reviewed by Greptile

… the editor

Recording or importing a clip into an open project appends it and then
rebuilds the editor window, which fitted the timeline from 0:00 again. The
reload now carries the old window's position and zoom into the new one,
applied where the first render would otherwise fit the timeline. A view that
was never fitted is ignored, since restoring a zero zoom would zoom all the
way in.
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

@Zingzy is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@richiemcilroy

Copy link
Copy Markdown
Member

@greptileai review

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.

2 participants