JAL-3732 - sequences can be moved up/down in cursor mode via alt-up/down arrow
authorJim Procter <jprocter@issues.jalview.org>
Mon, 31 Aug 2020 16:49:18 +0000 (17:49 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 31 Aug 2020 16:50:19 +0000 (17:50 +0100)
JAL-3733 TODO - provide an undo for sequence/group up/down moves

src/jalview/gui/AlignFrame.java

index 910ab63..8e7820f 100644 (file)
@@ -1782,10 +1782,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * DOCUMENT ME!
+   * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection or the sequence under cursor in keyboard mode 
    * 
    * @param up
-   *          DOCUMENT ME!
+   *          or down (if !up)
    */
   public void moveSelectedSequences(boolean up)
   {
@@ -1793,8 +1793,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     if (sg == null)
     {
-      return;
+      if (viewport.cursorMode) 
+      {
+        sg = new SequenceGroup();
+        sg.addSequence(viewport.getAlignment()
+                .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY),false);
+      } else {
+        return;
+      }
+    }
+    
+    if (sg.getSize() < 1)
+    {
+        return;
     }
+    
+    // TODO: JAL-3733 - add an event to the undo buffer for this !
+    
     viewport.getAlignment().moveSelectedSequencesByOne(sg,
             viewport.getHiddenRepSequences(), up);
     alignPanel.paintAlignment(true, false);