Fix undo not fully reverting image and SVG imports#3906
Fix undo not fully reverting image and SVG imports#3906ziad-ashraf7 wants to merge 2 commits intoGraphiteEditor:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug where undoing an image or SVG import required two separate undo actions. By consolidating the layer creation and display name assignment into a single history step, the change streamlines the undo process, allowing users to fully revert an import with just one undo command, thereby improving the user experience. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where undoing an image or SVG import required two undo steps. The change correctly sets skip_adding_history_step to true for the SetDisplayName call during import, ensuring the rename operation is part of the same history transaction as the layer creation. The fix is applied consistently for both image and SVG imports.
There was a problem hiding this comment.
No issues found across 1 file
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
|
yeah LGTM, thanks @0HyperCube for providing details and resolution for this |
|
Thank you Mr. @Ayush2k02 for approving the PR, so happy for that ! Also Thank you Mr. @0HyperCube for putting me on the right way to solve the issue and have a good exposure on the solution. Is there anything else that i should do now to make the PR merged ? so I can now look for more issues to resolve. |
Fixes: #3904
Before:
(See the video in the mentioned issue)
After:
2026-03-17.03-13-24.mp4
Files Changed:
editor/src/messages/portfolio/document/document_message_handler.rsDescription:
When importing an image or SVG, the SetDisplayName call was creating a separate history step because
skip_adding_history_step was set to false.
This meant a single undo would only revert the rename, requiring a second undo to actually delete the imported layer.
Setting skip_adding_history_step to true keeps the rename as part of the same transaction as the layer creation, so one undo fully reverts the import.