UC-Davis-molecular-computing / scadnano

Web application for designing DNA structures such as DNA origami.
https://scadnano.org
MIT License
22 stars 13 forks source link

undo autopaste should (maybe) reset autopaste "vector" #946

Open dave-doty opened 1 year ago

dave-doty commented 1 year ago

Draw a strand:

image

Copy/Paste:

image

Press Ctrl+Shift+V to autopaste three times:

image

Press Ctrl+Z three times to undo:

image

Now press Ctrl+Shift+V to autopaste again:

image

Note that this goes in the place where autopaste would have pasted the next strand after the most recent autopaste. However, this is somewhat unexpected behavior; a user might expect "Undo" to mean "Undo the autopaste meta-information about where the next autopasted strand should go" and expected Autopaste to put the strand adjacent to the existing strands, as it did the first time.

dave-doty commented 1 month ago

What should happen here is that autopaste should put the third strand immediately to the right of the second strand, as happened the first time that we only had two strands. In other words we need Undo to undo not only the change to which strands are in the design, but also undo the change in internal Autopaste data (stored in AppUIState.copy_info) that happens after each time you press Ctrl+Shift+V.

dave-doty commented 1 month ago

I think the most straightforward fix here is to include a CopyInfo field in the UndoRedoItem object, alongside the Design.