From 116f0a097d2eb368760877c42b87c5cebcb56df2 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 13 May 2024 17:05:11 +0100 Subject: [PATCH] JAL-518 better test coverage and support for case preservation --- .../commands/JustifyLeftOrRightCommand.java | 16 +++++++++++----- test/jalview/commands/EditCommandTest.java | 20 +++++++++++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/jalview/commands/JustifyLeftOrRightCommand.java b/src/jalview/commands/JustifyLeftOrRightCommand.java index f83f754..2559662 100644 --- a/src/jalview/commands/JustifyLeftOrRightCommand.java +++ b/src/jalview/commands/JustifyLeftOrRightCommand.java @@ -25,6 +25,7 @@ import java.util.List; import jalview.datamodel.AlignmentI; import jalview.datamodel.ContiguousI; import jalview.datamodel.SequenceI; +import jalview.util.Comparison; public class JustifyLeftOrRightCommand extends EditCommand { @@ -57,6 +58,11 @@ public class JustifyLeftOrRightCommand extends EditCommand { continue; } + char[] range = seq.getSequence(from, to+1); + if (range==null || range.length==0) + { + continue; + } int dsstart = seq.getDatasetSequence().getStart(); char[] sqchar = seq.getDatasetSequence().getSequence( -dsstart + cont.getBegin(), -dsstart + cont.getEnd() + 1); @@ -72,9 +78,12 @@ public class JustifyLeftOrRightCommand extends EditCommand alseq[gapstart + gp] = gc; } - for (int sqp = 0; sqp < sqchar.length; sqp++) + for (int sqp = 0,insp=0; sqp