JAL-1233 JAL-1576 copy constructor to propagate helix colours and applyTo implementat...
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index 5617bcf..a3b7527 100644 (file)
@@ -2501,14 +2501,14 @@ public abstract class AlignmentViewport implements AlignViewportI,
    */
   protected int findComplementScrollTarget(SearchResults sr)
   {
-    final AlignViewportI codingComplement = getCodingComplement();
-    if (codingComplement == null || !codingComplement.isFollowHighlight())
+    final AlignViewportI complement = getCodingComplement();
+    if (complement == null || !complement.isFollowHighlight())
     {
       return 0;
     }
     boolean iAmProtein = !getAlignment().isNucleotide();
     AlignmentI proteinAlignment = iAmProtein ? getAlignment()
-            : codingComplement.getAlignment();
+            : complement.getAlignment();
     if (proteinAlignment == null)
     {
       return 0;
@@ -2531,7 +2531,12 @@ public abstract class AlignmentViewport implements AlignViewportI,
     int middleColumn = getStartRes() + (getEndRes() - getStartRes()) / 2;
     final HiddenSequences hiddenSequences = getAlignment()
             .getHiddenSequences();
-    for (int seqNo = getStartSeq(); seqNo < getEndSeq(); seqNo++, seqOffset++)
+    
+    /*
+     * searching to the bottom of the alignment gives smoother scrolling across all gapped visible regions
+     */
+    int lastSeq = alignment.getHeight() - 1;
+    for (int seqNo = getStartSeq(); seqNo < lastSeq; seqNo++, seqOffset++)
     {
       sequence = getAlignment().getSequenceAt(seqNo);
       if (hiddenSequences != null && hiddenSequences.isHidden(sequence))
@@ -2546,7 +2551,7 @@ public abstract class AlignmentViewport implements AlignViewportI,
               .findMappingsForSequence(sequence, mappings);
       if (!seqMappings.isEmpty())
       {
-        break;
+          break;
       }
     }