X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcommands%2FEditCommand.java;h=83e44174ba49be74307137bd15c2349ab57da63d;hb=d587f1aa61946dc14f6f089cf1dc2a3116cfb773;hp=a53798ac9ae24c3a8b3c9beb9b480599fcc71bc2;hpb=ebb678af128304dc13e1b6ec9e0961489bf83d39;p=jalview.git diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index a53798a..83e4417 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -99,6 +99,11 @@ public class EditCommand implements CommandI return edits==null?0:edits.length; } + public AlignmentI getAlignment() + { + return edits[0].al; + } + public void appendEdit(String command, SequenceI[] seqs, @@ -200,11 +205,14 @@ public class EditCommand implements CommandI for(int i=0; icommand.position) + { + command.string[i] = command.seqs[i].getSequence(command.position, + command.position + command.number); - command.seqs[i].deleteChars(command.position, - command.position+command.number); + command.seqs[i].deleteChars(command.position, + command.position + command.number); + } if(command.seqs[i].getLength()<1) { @@ -229,8 +237,20 @@ public class EditCommand implements CommandI command.al.addSequence(command.seqs[i]); } tmp = new StringBuffer(command.seqs[i].getSequence()); - if(command.string!=null) + + if(command.string!=null && command.string[i]!=null) { + if(command.position>=tmp.length()) + { + //This occurs if padding is on, and residues + //are removed from end of alignment + int length = command.position-tmp.length(); + while (length > 0) + { + tmp.append(command.gapChar); + length--; + } + } tmp.insert(command.position, command.string[i]); command.string[i] = null; } @@ -270,6 +290,7 @@ public class EditCommand implements CommandI int number, AlignmentI al) { + this.gapChar = al.getGapCharacter(); this.command = command; this.seqs = seqs; this.position = position;