From e7117e6bd2796e36d73fb83c26b3442ffc96a1e4 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 24 Oct 2017 15:08:57 +0100 Subject: [PATCH] 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 --- src/jalview/commands/EditCommand.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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) { -- 1.7.10.2