JAL-2089 Merge branch releases/Release_2_10_Branch to master
[jalview.git] / src / jalview / datamodel / SearchResults.java
index d7d9ec9..4dda81a 100755 (executable)
@@ -67,8 +67,22 @@ public class SearchResults
     public Match(SequenceI seq, int start, int end)
     {
       sequence = seq;
-      this.start = start;
-      this.end = end;
+
+      /*
+       * always hold in forwards order, even if given in reverse order
+       * (such as from a mapping to a reverse strand); this avoids
+       * trouble for routines that highlight search results etc
+       */
+      if (start <= end)
+      {
+        this.start = start;
+        this.end = end;
+      }
+      else
+      {
+        this.start = end;
+        this.end = start;
+      }
     }
 
     public SequenceI getSequence()