From: Jim Procter Date: Mon, 13 May 2024 16:05:11 +0000 (+0100) Subject: JAL-518 better test coverage and support for case preservation X-Git-Tag: Release_2_11_4_0~45^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=116f0a097d2eb368760877c42b87c5cebcb56df2;p=jalview.git JAL-518 better test coverage and support for case preservation --- 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