Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy command #140

Merged
merged 22 commits into from
Sep 1, 2021
Merged

Copy command #140

merged 22 commits into from
Sep 1, 2021

Conversation

RobbeDP
Copy link
Contributor

@RobbeDP RobbeDP commented Jul 30, 2021

As discussed in #132, most of the code written for the cut command could be reused in order to write the copy command. This is what I did here.

First of all, I created a new command ReadSelectionCommand, which is almost completely identical to the DeleteSelectionCommand, except for the fact that the nodes in the given range are not deleted and that the changes made on the VDOM are not written back to the DOM. In order to implement this second requirement, I created a way to store the model and restore it later on.

This way of storing and restoring the model introduced for a new way to implement the undo command and this is what I did here as well. A new snapshot gets stored in the history before every command is executed (except if the command says otherwise), since normally the commands will be the only thing that can manipulate the VDOM.

I provided a seperate command for the undo and a seperate input handler for the copy command.

@RobbeDP RobbeDP marked this pull request as ready for review August 3, 2021 14:38
@RobbeDP RobbeDP requested a review from abeforgit August 3, 2021 15:00
Copy link
Member

@abeforgit abeforgit left a comment

Choose a reason for hiding this comment

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

Works well on the surface, but we can't merge this yet because non-command document edits such as backspace don't create a snapshot, and are skipped over when undoing

@RobbeDP RobbeDP mentioned this pull request Aug 6, 2021
@RobbeDP RobbeDP requested a review from abeforgit August 6, 2021 16:07
@RobbeDP
Copy link
Contributor Author

RobbeDP commented Aug 8, 2021

This PR now only contains the changes that introduce the copy command. The model undo has been moved to #143.

@abeforgit abeforgit added the enhancement New feature or request label Aug 31, 2021
@abeforgit
Copy link
Member

this is already behind a feature flag, so I think we can merge this

@nvdk nvdk merged commit 4db01c4 into development Sep 1, 2021
@nvdk nvdk deleted the feature/copy-command branch September 1, 2021 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants