From: Jim Procter Date: Tue, 24 Oct 2017 14:08:57 +0000 (+0100) Subject: JAL-2541 Cut ops always stash the old dataset sequence reference so can be restored... X-Git-Tag: Release_2_11_1_0~98^2~23^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e7117e6bd2796e36d73fb83c26b3442ffc96a1e4;p=jalview.git JAL-2541 Cut ops always stash the old dataset sequence reference so can be restored by Paste op without needing to test if Paste inserts new data --- diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index 2d27f4b..4c2f8e7 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -541,21 +541,22 @@ public class EditCommand implements CommandI if (command.oldds != null && command.oldds[i] != null) { - // oldds entry contains the cut dataset sequence. + // Undoing previous Paste - so + // oldds entry contains the cut dataset sequence, + // with sequence features in expected place. sequence.setDatasetSequence(command.oldds[i]); command.oldds[i] = oldds; } else { - // modify the oldds if necessary - if (oldds != sequence.getDatasetSequence() - || sequence.getFeatures().hasFeatures()) + // New cut operation + // We always keep track of the dataset sequence so we can safely + // restore it during the Undo + if (command.oldds == null) { - if (command.oldds == null) - { - command.oldds = new SequenceI[command.seqs.length]; - } - command.oldds[i] = oldds; + command.oldds = new SequenceI[command.seqs.length]; + } + command.oldds[i] = oldds; if (cutPositions != null) {