From ea94f71e4b8bd5ceda06e696f6e92723cc2d9db1 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 1 Jul 2015 14:15:19 +0100 Subject: [PATCH] JAL-1802 handle slide sequences edits in split frame mode --- src/jalview/datamodel/Sequence.java | 8 ++++---- src/jalview/gui/AlignFrame.java | 7 ++++++- src/jalview/util/StringUtils.java | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) 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; } -- 1.7.10.2