Skip to content

In-app shape copy and paste (Ctrl+C / Ctrl+V) - #243

Merged
trailcode merged 3 commits into
mainfrom
copy-paste
Aug 3, 2026
Merged

In-app shape copy and paste (Ctrl+C / Ctrl+V)#243
trailcode merged 3 commits into
mainfrom
copy-paste

Conversation

@trailcode

@trailcode trailcode commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds remappable Ctrl+C / Ctrl+V (edit.copy / edit.paste) for an in-app shape clipboard.
  • Deep-copies selected solids, or a Shape List group subtree when the selection matches that group's descendant solids.
  • Paste inserts under the current group (new ids, uniquified names, same pose) with one Shape_add_delta; clipboard survives New.
  • Docs, settings defaults, and unit tests included.

Closes #242

Test plan

  • EzyCad_tests --gtest_filter=Shp_test.Copy*:Shp_test.New_file*
  • Manual: select solids → Ctrl+C / Ctrl+V (in place, undo)
  • Manual: click Shape List group → Ctrl+C → paste preserves nesting
  • Manual: copy → New → paste into blank project
  • Settings → Keyboard shortcuts shows Copy / Paste (Ctrl+C / Ctrl+V)
  • Script console text Ctrl+C/V still works while typing
  • Spot-check docs/usage.md / usage-settings.md / CHANGELOG

Note

Medium Risk
New document mutation path with hierarchy edge cases (group subtree, sibling paste, cycle guards); mitigated by extensive unit tests and all-or-nothing paste validation.

Overview
Adds in-app shape copy/paste via remappable edit.copy / edit.paste (defaults Ctrl+C / Ctrl+V), wired through hotkeys and Occt_view::copy_selected_shapes / paste_clipboard_shapes. Copy snapshots selected solids or, when the selection exactly matches a Shape List group’s descendant solids, the whole subtree into a session Shape_rec forest with independent BREP (not the OS clipboard). Paste deep-copies under the current group (new ids, uniquified names, same pose), uses one Shape_add_delta for undo, and pastes as a sibling when the current group is still the copied group root.

File → New keeps clipboard contents but clears live source-root tracking so copy → New → paste works. Parent-chain walks (would_reparent_create_cycle, shape_descendant_solids, shape_ancestors_visible) and Shape List drawing gain cycle guards to avoid hangs on corrupt hierarchy.

Docs, res/ezycad_settings.json, and Shp_test Copy_* / New_file_keeps_shape_clipboard tests are included. Sketch geometry and OS clipboard are unchanged.

Reviewed by Cursor Bugbot for commit 15a0f38. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7ab8be5. Configure here.

Comment thread src/gui_occt_view.cpp Outdated
@trailcode
trailcode merged commit 0c4217a into main Aug 3, 2026
4 checks passed
@trailcode
trailcode deleted the copy-paste branch August 3, 2026 23:33
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.

In-app shape copy and paste (Ctrl+C / Ctrl+V)

1 participant