Skip to content

feat(gpui): rename timeline lanes - #2847

Open
YoavLevavi wants to merge 4 commits into
CapSoftware:mainfrom
YoavLevavi:feat/gpui-track-names
Open

YoavLevavi wants to merge 4 commits into
CapSoftware:mainfrom
YoavLevavi:feat/gpui-track-names

Conversation

@YoavLevavi

@YoavLevavi YoavLevavi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Rename timeline lanes: double-click a lane's label in the gutter to give it a name ("Music", "Voice-over"...).

  • ProjectConfiguration::track_names, keyed "<track>:<lane>" (for example audio:1), #[serde(default)].
  • A small rename dialog. Enter confirms, Escape cancels, and an empty name restores the track's own label. One undo step.
  • track_chip shows the name, and TimelineModel carries the names so drawing doesn't touch the project.

Testing: cargo test --bin cap-gpui (new lane_names_come_from_the_project_by_track_and_lane).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The style-group rename fix is sound, but the earlier lane-deletion bug and comments-rule violation still need fixes before merging.

Findings

  1. P1 Deletion gives lanes wrong names ▶
  2. P2 Comments repeat the code ▶
Fix with agent prompt
### Issue 1
apps/desktop-gpui/src/editor_timeline.rs:2217-2221
Lane deletion shifts segment indexes but leaves the new `track_names` keys unchanged. Name `audio:0` “Voice” and `audio:1` “Music”, then delete lane 0: the music segments move to lane 0 and display “Voice”. Remove the deleted lane’s name and shift higher name keys down in the same edit, including when deleting an empty lane.

### Issue 2
apps/desktop-gpui/src/editor_window.rs:undefined-1590
The new comment above `track_rename` only restates the fields and gesture. `AGENTS.md` requires comments to explain non-obvious context and explicitly bans comments that narrate the code. Remove this comment and the similarly descriptive comment above `open_track_rename`. This repository requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

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

Summary

Adds custom timeline lane names and a rename dialog.

  • Timeline lanes can show names you choose.
  • Style and audio lane names move with their lanes.

Reviews (2) · Last reviewed commit: "Save lane renames past an open style gro..." · Reviewed by Greptile

Names are stored per lane in ProjectConfiguration::track_names, keyed
"<track>:<lane>"; an empty name restores the track's own label.

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

Copy link
Copy Markdown
Contributor Author

@greptileai

@vercel

vercel Bot commented Oct 21, 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.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks @YoavLevavi, lane names are handy, and the dialog follows the preset dialog's patterns nicely (Enter/Escape, one undo step, an empty name restores the default). One functional issue: names are keyed "<track>:<lane>", but lanes can be reordered by dragging the gutter, and finish_lane_reorder (apps/desktop-gpui/src/editor_window.rs:4555) rewrites every segment's track through edits::reorder_track_lane / edits::reorder_overlay_track without touching track_names. If you name lane 1 "Music" and drag it above lane 0, the music now sits on lane 0 while lane 1, holding the other audio, is still called "Music". Could you remap project.track_names with the same from/to shift in those reorder paths (in the same edit, so it stays one undo step) and add a test for it? Two smaller things: track_name_key was inserted between track_chip and its doc comment (apps/desktop-gpui/src/editor_timeline.rs:1791-1798), so please move it above that comment. And please add skip_serializing_if = "std::collections::BTreeMap::is_empty" to track_names (crates/project/src/configuration.rs:2686), so projects without names save unchanged, the way #2781 does for locked_tracks.

YoavLevavi and others added 2 commits October 25, 2026 17:20
- reorder_track_names moves a track's lane names with the same shift as
  reorder_track_lane, in the same edit, so a renamed lane keeps its name
  after being dragged (overlay reorders only change overlay_order, so their
  names already stay put). Test included.
- track_names is skipped when empty, so projects without names save
  unchanged; bindings regenerated. track_name_key sits above track_chip's
  doc comment again.
- Merges origin/main; audio_project_key lists track_names as not affecting
  playback audio.

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

Copy link
Copy Markdown
Contributor Author

Thanks @richiemcilroy, all three are in 3753c65 (also merged main):

  1. Reordered lanes. finish_lane_reorder now runs reorder_track_names with the same shift as reorder_track_lane, in the same edit, so it's one undo step. Overlay reorders only change overlay_order, not segment tracks, so their names already stay with their lane. lane_names_follow_their_lane_when_lanes_are_reordered covers it.
  2. Code placement. track_name_key now sits above track_chip's doc comment.
  3. Empty names. track_names has skip_serializing_if = "BTreeMap::is_empty", bindings are regenerated, and tsc is clean. Main's new audio_project_key lists it as not affecting audio.

@greptileai review

Comment on lines +2217 to +2221
.child(track_chip(
theme,
row.kind,
model.track_names.get(&track_name_key(row)).cloned(),
)),

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 Deletion gives lanes wrong names

Lane deletion shifts segment indexes but leaves the new track_names keys unchanged. Name audio:0 “Voice” and audio:1 “Music”, then delete lane 0: the music segments move to lane 0 and display “Voice”. Remove the deleted lane’s name and shift higher name keys down in the same edit, including when deleting an empty lane.

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

Comment:
**Deletion gives lanes wrong names**

Lane deletion shifts segment indexes but leaves the new `track_names` keys unchanged. Name `audio:0` “Voice” and `audio:1` “Music”, then delete lane 0: the music segments move to lane 0 and display “Voice”. Remove the deleted lane’s name and shift higher name keys down in the same edit, including when deleting an empty lane.

---

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

Comment thread apps/desktop-gpui/src/editor_window.rs Outdated
Comment on lines +7393 to +7399
self.edit_project("track-rename", window, cx, move |project| {
if default {
project.track_names.remove(&key).is_some()
} else if project.track_names.get(&key) == Some(&name) {
false
} else {
project.track_names.insert(key, name);

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 Open style groups discard renames

Open a style group for the selected style segment, then double-click that same lane’s label. Selecting the same segment leaves sidebar.style_target set, so edit_project sends the rename through apply_style_control_change. That function changes a cloned project and copies back only style settings, discarding track_names. The dialog closes without saving the name. Use a project-wide edit path that does not route through the selected style group.

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

Comment:
**Open style groups discard renames**

Open a style group for the selected style segment, then double-click that same lane’s label. Selecting the same segment leaves `sidebar.style_target` set, so `edit_project` sends the rename through `apply_style_control_change`. That function changes a cloned project and copies back only style settings, discarding `track_names`. The dialog closes without saving the name. Use a project-wide edit path that does not route through the selected style group.

---

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

/// exactly as the Solid dialogs replace the dropdown.
presets_menu: Option<PresetsMenu>,
preset_dialog: Option<PresetDialog>,
/// The lane being renamed (double-click on its label), and the input.

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.

P2 Comments repeat the code

The new comment above track_rename only restates the fields and gesture. AGENTS.md requires comments to explain non-obvious context and explicitly bans comments that narrate the code. Remove this comment and the similarly descriptive comment above open_track_rename. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

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

Comment:
**Comments repeat the code**

The new comment above `track_rename` only restates the fields and gesture. `AGENTS.md` requires comments to explain non-obvious context and explicitly bans comments that narrate the code. Remove this comment and the similarly descriptive comment above `open_track_rename`. This repository requirement must be satisfied before merging.

**Context Used:** AGENTS.md ([source](https://github.com/capsoftware/cap/blob/main/AGENTS.md))

---

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@YoavLevavi

Copy link
Copy Markdown
Contributor Author

Fixed in b349374: commit_track_rename now writes track_names straight to the project and calls project_changed, instead of going through edit_project. An open style group can no longer route the rename through apply_style_control_change and drop it.

@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