Skip to content

fix(desktop-gpui): keep segment resizes from overlapping their neighbours - #2834

Merged
richiemcilroy merged 3 commits into
CapSoftware:mainfrom
yashranaway:fix/segment-resize-bounds
Oct 22, 2026
Merged

richiemcilroy merged 3 commits into
CapSoftware:mainfrom
yashranaway:fix/segment-resize-bounds

Conversation

@yashranaway

@yashranaway yashranaway commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

resizing the end of a zoom or other effect segment uses a minimum length of 80 pixels, which is several seconds when the timeline is zoomed out. if that minimum didn't fit before the next segment or the end of the project, the bound just pushed past them, so the drag forced the segment over its neighbour or off the end, like 10s instead of 6s.

now the minimum is capped at the space that's actually there, and a segment already past a shortened timeline keeps its range instead of being flipped. same helper covers snapped and unsnapped drags for every effect track. it's the resize side of the gap placement fix in #2744.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Updates trim_end_bounds so a large minimum length no longer pushes an effect past its neighbour or the timeline end.

  • Segment ends stay within available timeline space when dragged.

Reviews (1) · Last reviewed commit: "fix(desktop-gpui): keep a short segment ..." · Reviewed by Greptile

@yashranaway

Copy link
Copy Markdown
Contributor Author

@greptileai review

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@yashranaway 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 @yashranaway, this is a real fix: on main trim_end_bounds (apps/desktop-gpui/src/editor_edits.rs:441) forces the end to start + min_duration even when that runs past the next segment or the timeline end, and capping at max stops the overlap. One leftover in the same scenario: when the pixel minimum does not fit, min and max both become next_start, so grabbing the end handle and dragging left still grows the segment up to its neighbour. Your first test shows it: the zoom is 2..5, requested_end 4 resolves to 6. Could you also cap min at the segment's current end, e.g. let min = (segment.start + min_duration).min(segment.end).min(max);? That is what audio_trim_end_bounds already does with bounds.min.min(segment.end). A segment that is already shorter than the zoomed-out minimum then can't shrink, but it won't grow when you drag it left, and it can still be extended up to next_start. Please update the first test so that requesting 4 keeps the end at 5.

@yashranaway

Copy link
Copy Markdown
Contributor Author

@richiemcilroy good catch, capped min at the segment's current end in fdc5325 like the audio trim bounds, and the first test now checks requesting 4 keeps the end at 5.

@yashranaway

Copy link
Copy Markdown
Contributor Author

@greptileai review

1 similar comment
@richiemcilroy

Copy link
Copy Markdown
Member

@greptileai review

@richiemcilroy
richiemcilroy merged commit 82c1d2f into CapSoftware:main Oct 22, 2026
35 of 39 checks passed
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