JAL-3680 check whether a sequence selection exists before sliding the sequence under...
authorJim Procter <jprocter@issues.jalview.org>
Sat, 4 Jul 2020 12:17:00 +0000 (13:17 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sat, 4 Jul 2020 13:22:11 +0000 (14:22 +0100)
src/jalview/gui/AlignFrame.java

index 0a42036..61a6af6 100644 (file)
@@ -1740,19 +1740,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   synchronized void slideSequences(boolean right, int size)
   {
     List<SequenceI> sg = new ArrayList<>();
-    if (viewport.cursorMode)
-    {
-      sg.add(viewport.getAlignment()
-              .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY));
-    }
-    else if (viewport.getSelectionGroup() != null
-            && viewport.getSelectionGroup().getSize() != viewport
-                    .getAlignment().getHeight())
+    if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup()
+            .getSize() != viewport.getAlignment().getHeight())
     {
       sg = viewport.getSelectionGroup()
               .getSequences(viewport.getHiddenRepSequences());
     }
 
+    if (sg.size() == 0 && viewport.cursorMode)
+    {
+      sg.add(viewport.getAlignment()
+              .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY));
+    }
+
     if (sg.size() < 1)
     {
       return;