Repository navigation
feat(desktop-gpui): copy and paste text segment styles from the timeline menu - #2822
Conversation
|
@chrvasile 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 Hey there, big fan and user of Cap. As I was using it today, I realised something that was annoying me, and I submitted here a suggestion. I'm new to OSS and I hope I've done this the right way and that you're willing to take a look at this. Thank you! |
|
@greptileai review |
| let previous_style = Self::of(segment); | ||
| let previous_center = segment.center; | ||
| let previous_size = segment.size; | ||
| scale_text_box(segment, self.font_size); |
There was a problem hiding this comment.
TextStyle::apply_to rescales the box even when the font size is unchanged. With center.y = 0.9 and size.y = 0.4, the calculation changes center.y to 0.8999999999999999. Pasting a style back onto its source then returns true and adds an undo step despite making no visible change.
Skip scale_text_box when the font sizes match, and add this case to the no-op test.
| scale_text_box(segment, self.font_size); | |
| if segment.font_size != self.font_size { | |
| scale_text_box(segment, self.font_size); | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_panels.rs
Line: 733
Comment:
**Unchanged paste adds undo**
`TextStyle::apply_to` rescales the box even when the font size is unchanged. With `center.y = 0.9` and `size.y = 0.4`, the calculation changes `center.y` to `0.8999999999999999`. Pasting a style back onto its source then returns `true` and adds an undo step despite making no visible change.
Skip `scale_text_box` when the font sizes match, and add this case to the no-op test.
```suggestion
if segment.font_size != self.font_size {
scale_text_box(segment, self.font_size);
}
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Hey @chrvasile, thanks for this, copy and paste for text styles is a really nice quality-of-life addition and the no-op test is a good touch. Greptile's one finding this round is valid: After pushing, could you comment |
|
@greptileai review |
|
Thanks @chrvasile, the font size check in |
…copy-paste # Conflicts: # apps/desktop-gpui/src/editor_panels.rs
|
@greptileai review |
| /// The look of one text segment, lifted off it by "Copy Style" on the | ||
| /// timeline. Content, timing, lane, position and layout stay with the target | ||
| /// when it is pasted; the box is rescaled with the font size the same way a | ||
| /// preset does it. |
There was a problem hiding this comment.
The new TextStyle overview describes the feature and repeats what its methods do. AGENTS.md allows comments for non-obvious context and explicitly bans comments that describe the change being made. Remove this overview, or keep only a specific invariant that the code cannot explain. This repository requirement must be satisfied before merging.
| /// The look of one text segment, lifted off it by "Copy Style" on the | |
| /// timeline. Content, timing, lane, position and layout stay with the target | |
| /// when it is pasted; the box is rescaled with the font size the same way a | |
| /// preset does it. |
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_panels.rs
Line: 671-674
Comment:
**Comment repeats the feature**
The new `TextStyle` overview describes the feature and repeats what its methods do. `AGENTS.md` allows comments for non-obvious context and explicitly bans comments that describe the change being made. Remove this overview, or keep only a specific invariant that the code cannot explain. This repository requirement must be satisfied before merging.
```suggestion
```
**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!
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@greptileai review |
| /// the segment unless it is already part of the selection, then open its | ||
| /// menu at the pointer. Clips get the speed popover, text segments the | ||
| /// Copy / Paste Style menu; other tracks have no context menu, and split |
There was a problem hiding this comment.
Comment repeats the menu behavior
The added description above track_context_menu repeats what the function does. AGENTS.md bans comments that narrate behavior or describe the current change. Remove the added narration; keep only non-obvious context. 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: 7924-7926
Comment:
**Comment repeats the menu behavior**
The added description above `track_context_menu` repeats what the function does. `AGENTS.md` bans comments that narrate behavior or describe the current change. Remove the added narration; keep only non-obvious context. 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!
…original note Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@greptileai review |
|
Thanks @richiemcilroy, and apologies for the back and forth. I think it's all fixed now. |
There was no way to carry a text segment's look over to another one. The only options were redoing every setting by hand or picking a preset, so a project with several captions that should match took a lot of repeated clicks.
Now right-clicking a text segment on the timeline opens a menu with Copy style, Paste style and Delete text segment. Paste copies the font, size, weight, italic, uppercase, alignment, letter spacing, line height, colour, background, outline, glow, shadow, opacity and the in/out animations with their durations. Content, timing, lane, position and layout stay with the target, and the box rescales from its top edge the way presets already do. Right-clicking a segment that's part of a multi-selection pastes onto the whole selection. The copied style lives in the editor window only and doesn't touch the system clipboard.
The menu reuses the clip popover's card and rows at a narrower width, and adds Lucide's clipboard-paste glyph next to the existing copy and trash icons. Paste is dimmed with a hint until something has been copied.
Screenshots:


Three tests cover that the paste keeps content, timing, position and layout, that the box scales about its top edge, and that pasting a style back onto its own source changes nothing.
Validation
cargo fmt -p cap-desktop-gpuicargo check -p cap-desktop-gpuicargo test -p cap-desktop-gpui editor_panels::tests: 36 passedcargo clippy -p cap-desktop-gpui --bin cap-gpui -- -D warnings: no new warnings in the touched filesgit diff --checkHow this was made
The change was written with Claude Code, reviewed with Codex, with a design decision review, fixes, and manual testing done by me.


Confidence Score: 5/5
The PR appears safe to merge, with all previous findings addressed and no new actionable issues found.Summary
Adds Copy style and Paste style to the timeline menu for text segments.
Reviews (5) · Last reviewed commit: "chore(desktop-gpui): trim the track_cont..." · Reviewed by Greptile