From: kiramt Date: Tue, 26 Sep 2017 18:33:07 +0000 (+0100) Subject: JAL-2742 fixed X-Git-Tag: Release_2_10_3b1~111^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4643fc24cc1802814da8653904d8d8b9835395e3;p=jalview.git JAL-2742 fixed --- 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); }