Move line up and down

Move line up and down

4
NewbieNewbie
4

    May 02, 2007#1

    Can UE add this two features?
    Move Up Current Line
    Move Down Current Line

    Many free text editor have this features.

    6,681583
    Grand MasterGrand Master
    6,681583

      May 02, 2007#2

      Yes, with 2 JavaScripts or 2 macros assigned to hotkeys for fast execution you can move current line up or down. Here is the macro for current line down:

      InsertMode
      ColumnModeOff
      HexOff
      Clipboard 9
      SelectLine
      Cut
      Key DOWN ARROW
      Paste
      Key UP ARROW
      ClearClipboard
      Clipboard 0

      The cursor is at start of the moved line after execution.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        May 02, 2007#3

        I write 2 macros like this, but it failed at the last line without push the "Enter" key.

        Like this(The second line):
        Line1 1111
        Line2 2222
        Line3 3333(No "Enter" here)

        Sorry for my poor English :-)

        6,681583
        Grand MasterGrand Master
        6,681583

          May 02, 2007#4

          I really don't like text files where the last line has no line termination.

          Here is the macro for Line Down which handles this situation also correct:

          InsertMode
          ColumnModeOff
          HexOff
          Key END
          IfEof
          "
          "
          Else
          Clipboard 9
          SelectLine
          Cut
          Key DOWN ARROW
          Key END
          IfEof
          "
          "
          Else
          Key HOME
          IfColNumGt 1
          Key HOME
          EndIf
          EndIf
          Paste
          ClearClipboard
          Clipboard 0
          EndIf
          Key UP ARROW


          And here is the macro for Line Up:

          InsertMode
          ColumnModeOff
          HexOff
          Clipboard 9
          Key END
          IfEof
          "
          "
          Key UP ARROW
          EndIf
          SelectLine
          Cut
          Key UP ARROW
          Paste

          Key UP ARROW
          ClearClipboard
          Clipboard 0


          Note: These macros will not work for Unicode or UTF-8 files because of a bug with IfEof in currently latest release v13.00a+2 of UE (and any previous version).

          2007-11-02: The IfEof bug with Unicode files was fixed in UE v13.20.

          2010-12-31: Inserted command Key UP ARROW in the macro for moving line up to set the cursor to start of just moved line to be able to use the macro immediately again.
          Best regards from an UC/UE/UES for Windows user from Austria

          4
          NewbieNewbie
          4

            May 03, 2007#5

            Thank you :-)

              Jun 13, 2007#6

              Another problem : Undo to the original state must press "CTRL + Z" many times. Very inconvenient.
              Add this feature please :-)

              Edit: Move current line up and down is supported by UltraEdit since v14.00.