From: gmungoc Date: Wed, 1 Jul 2015 13:15:19 +0000 (+0100) Subject: JAL-1802 handle slide sequences edits in split frame mode X-Git-Tag: Release_2_10_0~585^2~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ea94f71e4b8bd5ceda06e696f6e92723cc2d9db1;p=jalview.git JAL-1802 handle slide sequences edits in split frame mode --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 37bb7a9..c78ec22 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -20,6 +20,9 @@ */ package jalview.datamodel; +import jalview.analysis.AlignSeq; +import jalview.util.StringUtils; + import java.util.ArrayList; import java.util.Enumeration; import java.util.List; @@ -27,9 +30,6 @@ import java.util.Vector; import fr.orsay.lri.varna.models.rna.RNA; -import jalview.analysis.AlignSeq; -import jalview.util.StringUtils; - /** * * Implements the SequenceI interface for a char[] based sequence object. @@ -768,7 +768,7 @@ public class Sequence extends ASequence implements SequenceI public void deleteChars(int i, int j) { int newstart = start, newend = end; - if (i >= sequence.length) + if (i >= sequence.length || i < 0) { return; } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d2e247f..6ce8140 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1822,9 +1822,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getSelectionGroup().getEndRes() + groupAdjustment); } + /* + * just extend the last slide command if compatible; but not if in + * SplitFrame mode + */ boolean appendHistoryItem = false; Deque historyList = viewport.getHistoryList(); - if (historyList != null + boolean inSplitFrame = getSplitViewContainer() != null; + if (!inSplitFrame && historyList != null && historyList.size() > 0 && historyList.peek() instanceof SlideSequencesCommand) { diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 1325ce5..c55d467 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -66,7 +66,7 @@ public class StringUtils */ public static final char[] deleteChars(char[] in, int from, int to) { - if (from >= in.length) + if (from >= in.length || from < 0) { return in; }