From: Charles Ofoegbu Date: Tue, 28 Oct 2014 10:35:44 +0000 (+0000) Subject: JAL-353 undo for successive removal of redundant sequence - bugfix X-Git-Tag: Jalview_2_9~155^2~14^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=de4321a270c223dd430dad21d1427763618363e9;p=jalview.git JAL-353 undo for successive removal of redundant sequence - bugfix --- diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index 83ba536..da2b552 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -215,28 +215,26 @@ public class EditCommand implements CommandI @Override final public void undoCommand(AlignmentI[] views) - { - int e = 0, eSize = edits.length; - for (e = eSize - 1; e > -1; e--) - { - switch (edits[e].command) - { - case INSERT_GAP: - deleteGap(edits[e]); - break; - case DELETE_GAP: - insertGap(edits[e]); - break; - case CUT: - paste(edits[e], views); - break; - case PASTE: - cut(edits[e], views); - break; - case REPLACE: - replace(edits[e]); - break; - } + { + for(Edit e : edits){ + switch (e.command) + { + case INSERT_GAP: + deleteGap(e); + break; + case DELETE_GAP: + insertGap(e); + break; + case CUT: + paste(e, views); + break; + case PASTE: + cut(e, views); + break; + case REPLACE: + replace(e); + break; + } } } @@ -355,7 +353,7 @@ public class EditCommand implements CommandI List sequences; synchronized (sequences = command.al.getSequences()) { - sequences.add(command.alIndex[i], command.seqs[i]); + sequences.add(command.alIndex[i] < 0 ? 0 : command.alIndex[i], command.seqs[i]); } } else