Skip to content

feat(gpui): lock timeline tracks so clip edits don't move them - #2781

Open
YoavLevavi wants to merge 5 commits into
CapSoftware:mainfrom
YoavLevavi:feat/gpui-track-lock
Open

YoavLevavi wants to merge 5 commits into
CapSoftware:mainfrom
YoavLevavi:feat/gpui-track-lock

Conversation

@YoavLevavi

@YoavLevavi YoavLevavi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

GPUI port of #2378.

  • ProjectConfiguration::locked_tracks (LockableTimelineTrack).
  • GPUI: a lock button in each track's gutter. edits::with_locked_tracks wraps the clip edits that ripple other tracks (deleting, merging and retiming clips) and keeps locked tracks' segments where they were.

Testing: new deleting_a_clip_leaves_locked_tracks_in_place test, cargo test --bin cap-gpui (edits/assets), cargo test -p cap-project --lib.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

Fix the Caption lock before merging; generated captions still move after clip edits.

Findings

  1. P1 Locked captions still move ▶
Fix with agent prompt
### Issue 1
apps/desktop-gpui/src/editor_edits.rs:1223-1224
For generated captions, `with_locked_tracks` restores `caption_segments`, but the next `project_changed` call runs `synchronize_caption_track(false)`. Deleting a clip or changing its speed changes the caption signature, so `synchronize_captions` replaces the restored positions with times calculated from the edited clips. Deleting a preceding 10-second clip therefore still moves a locked caption from 12 seconds to 2 seconds.

Make caption synchronization respect the lock, including when the project is reopened, and test this through the full edit path.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds saved track locks and gutter buttons. Clip deletion, merging, speed changes, and reordering restore locked tracks after moving other tracks.

  • Locked timeline tracks keep their segments in place during clip edits.

Reviews (1) · Last reviewed commit: "Track lock: keep locks out of presets; m..." · Reviewed by Greptile

Locked tracks (project config) keep their segments in place when
clips are deleted, merged or retimed. A lock button sits in each
track's gutter in the GPUI timeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@YoavLevavi

Copy link
Copy Markdown
Contributor Author

@greptileai

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks for the GPUI port @YoavLevavi, wrapping the rippling edits in with_locked_tracks is a neat approach and the config stays unchanged for existing projects. A few things: 1) apps/desktop-gpui/src/editor_edits.rs:1106-1112 the new function was inserted under the existing delete_clip_segments doc comment, so that doc now belongs to with_locked_tracks and delete_clip_segments lost its doc. Please move with_locked_tracks and lockable_track above that comment block. 2) Reordering clips in the Clips sidebar still ripples every track through drop_clip_transition (editor_clips.rs:276), so a locked track moves there. Please wrap that edit too. 3) The locked_tracks doc in crates/project/src/configuration.rs:2682 mentions trims and transitions, so please match it to what is actually covered. 4) The lock button is drawn on every lane (editor_window.rs:10983) but toggles the whole track kind, so on text, mask or audio tracks with several lanes clicking one lane's lock locks all of them. Either draw it once per kind or make the tooltip say it locks the whole track. Thanks!

- Reordering clips in the Clips sidebar runs through with_locked_tracks, so a
  locked track no longer moves when a dropped transition ripples the rest.
- The lock is drawn on a track's first lane only, since it locks the track.
- with_locked_tracks and lockable_track sit above delete_clip_segments' doc
  again, and the locked_tracks doc lists the edits actually covered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@richiemcilroy

Copy link
Copy Markdown
Member

Thanks for the quick turnaround @YoavLevavi, all four points are sorted: the doc comments are back in the right place, clip reordering now goes through with_locked_tracks with a test, the locked_tracks doc matches what is covered, and the lock is drawn once per track. One more thing I spotted on the full pass: presets. preset_config (apps/desktop-gpui/src/presets.rs:142) serializes the whole project, so a preset saved while a track is locked stores lockedTracks, and apply_preset (presets.rs:155) and apply_default_preset (apps/desktop-gpui/src/editor_window.rs:7142) replace the project with the preset's config. Applying Default or any older preset therefore silently unlocks the user's tracks, and a preset saved with locks turns them on in other projects. Locks are timeline state like overlay_order, so please strip lockedTracks in preset_config and keep current.locked_tracks in both apply paths, with a test next to applying_keeps_the_current_timeline_clips_and_layer_order. Thanks!

@YoavLevavi

Copy link
Copy Markdown
Contributor Author

Thanks @richiemcilroy, all four are addressed in 5da66c3:

  1. with_locked_tracks and lockable_track now sit above delete_clip_segments' doc again.
  2. Reordering in the Clips sidebar goes through with_locked_tracks. A new test checks that a locked track stays put while an unlocked one ripples when a reorder drops a transition.
  3. The locked_tracks doc now lists what's covered: delete, merge, retime, reorder.
  4. The lock is drawn once per track, on its first lane.

YoavLevavi and others added 2 commits October 25, 2026 16:40
- preset_config drops lockedTracks, and both apply paths keep the current
  project's locks, so applying a preset never locks or unlocks tracks.
- Merges origin/main; audio_project_key lists locked_tracks as not affecting
  playback audio.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@YoavLevavi

Copy link
Copy Markdown
Contributor Author

Thanks @richiemcilroy, good catch. Fixed in c9165e7 (also merged main): preset_config drops lockedTracks, and both apply_preset and apply_default_preset keep current.locked_tracks. track_locks_stay_with_the_project_not_the_preset checks that a preset never stores locks, keeps the current project's locks, and never locks an unlocked project. Main's new audio_project_key lists locked_tracks as not affecting playback audio.

@greptileai review

Comment on lines +1223 to +1224
LockableTimelineTrack::Caption => {
timeline.caption_segments = saved.caption_segments.clone()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Locked captions still move

For generated captions, with_locked_tracks restores caption_segments, but the next project_changed call runs synchronize_caption_track(false). Deleting a clip or changing its speed changes the caption signature, so synchronize_captions replaces the restored positions with times calculated from the edited clips. Deleting a preceding 10-second clip therefore still moves a locked caption from 12 seconds to 2 seconds.

Make caption synchronization respect the lock, including when the project is reopened, and test this through the full edit path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_edits.rs
Line: 1223-1224

Comment:
**Locked captions still move**

For generated captions, `with_locked_tracks` restores `caption_segments`, but the next `project_changed` call runs `synchronize_caption_track(false)`. Deleting a clip or changing its speed changes the caption signature, so `synchronize_captions` replaces the restored positions with times calculated from the edited clips. Deleting a preceding 10-second clip therefore still moves a locked caption from 12 seconds to 2 seconds.

Make caption synchronization respect the lock, including when the project is reopened, and test this through the full edit path.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

# Conflicts:
#	apps/desktop-gpui/src/editor_window.rs
#	apps/desktop-gpui/src/presets.rs

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