From 4643fc24cc1802814da8653904d8d8b9835395e3 Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 26 Sep 2017 19:33:07 +0100 Subject: [PATCH] JAL-2742 fixed --- src/jalview/datamodel/CigarArray.java | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index b6224c2..1723f1d 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -170,32 +170,30 @@ public class CigarArray extends CigarBase hideStart = region[0]; hideEnd = region[1]; // edit hidden regions to selection range - if (hideStart < last) + + // just move on if hideEnd is before last + if (hideEnd < last) { - if (hideEnd > last) - { - hideStart = last; - } - else - { - continue; - } + continue; } - + // exit if next region is after end if (hideStart > end) { break; } - if (hideEnd > end) + // truncate region at start if last falls in region + if ((hideStart < last) && (hideEnd >= last)) { - hideEnd = end; + hideStart = last; } - if (hideStart > hideEnd) + // truncate region at end if end falls in region + if (hideEnd > end) // already checked that hideStart<=end { - break; + hideEnd = end; } + /** * form operations... */ @@ -207,7 +205,7 @@ public class CigarArray extends CigarBase last = hideEnd + 1; } // Final match if necessary. - if (last < end) + if (last <= end) { addOperation(CigarArray.M, end - last + 1); } -- 1.7.10.2