JAL-4313 Test and patch annots trimming
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index 4ebb27f..e832c2f 100755 (executable)
@@ -854,15 +854,15 @@ public class AlignmentAnnotation
     }
     if (startRes >= annotations.length)
     {
-      startRes = annotations.length - 1;
+      startRes = annotations.length;
     }
-    if (endRes >= annotations.length)
+    if (endRes < 0)
     {
-      endRes = annotations.length - 1;
+      endRes = -1;
     }
-    if (annotations == null)
+    if (endRes >= annotations.length)
     {
-      return;
+      endRes = annotations.length - 1;
     }
     Annotation[] temp = new Annotation[endRes - startRes + 1];
     if (startRes < annotations.length)
@@ -1581,7 +1581,7 @@ public class AlignmentAnnotation
   {
     if (annotations != null)
     {
-      makeVisibleAnnotation(0, annotations.length, hiddenColumns);
+      makeVisibleAnnotation(0, annotations.length - 1, hiddenColumns);
     }
   }