+ StringBuffer tmp;
+ String oldstring;
+ int start = command.position;
+ int end = command.number;
+ // TODO TUTORIAL - Fix for replacement with different length of sequence (or
+ // whole sequence)
+ // TODO Jalview 2.4 bugfix change to an aggregate command - original
+ // sequence string is cut, new string is pasted in.
+ command.number = start + command.string[0].length;
+ for (int i = 0; i < command.seqs.length; i++)
+ {
+ /**
+ * cut addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT,
+ * cut, sg.getStartRes(), sg.getEndRes()-sg.getStartRes()+1,
+ * viewport.alignment));
+ *
+ */
+ /**
+ * then addHistoryItem(new EditCommand( "Add sequences",
+ * EditCommand.PASTE, sequences, 0, alignment.getWidth(), alignment) );
+ *
+ */
+ oldstring = command.seqs[i].getSequenceAsString();
+ tmp = new StringBuffer(oldstring.substring(0, start));
+ tmp.append(command.string[i]);
+ tmp.append(oldstring.substring(end));
+ command.seqs[i].setSequence(tmp.toString());
+ command.string[i] = oldstring.substring(start, end).toCharArray();
+ tmp = null;
+ oldstring = null;
+ }
+ }