Moving cursor to opposite end of a selection

Moving cursor to opposite end of a selection

3

    Aug 24, 2009#1

    Hi, this is probably a newbie question but I've searched around and I can't find a way to do this.

    If I've selected some text in UltraEdit, is there a way to move the cursor to the opposite end of the selection without affecting the selection range?

    Say I have the following selected text (non-selected text in blue; selected text in red; cursor in green):

    This is some |test text.

    I'm looking for a keypress or other method I can use to alter the cursor position as follows:

    This is some test| text.

    This would then allow me to alter the selection range on the opposite end to my original cursor position.

    Is this possible?

    6,675585
    Grand MasterGrand Master
    6,675585

      Aug 24, 2009#2

      There is no possibility (as far as I know) to move the cursor while a selection is active without modifying the selection.

      There is the Find Select method and the Goto Bookmark Select method which are often used to select something from current cursor position to end of a found string or from current cursor position to bookmark.


      From help of UltraEdit, page about the Find command:

      To select all text between the cursor position and the search target, hold down the SHIFT key at the time the search is started with the Find Next button.


      From help of UltraEdit, page about the Goto Line/Page/Bookmark command:

      When the Shift key is pressed at the same time as performing the Goto function, the current selection (if present) or a new selection will be extended to select text up to the cursor position following the command.


      Both work also in reverse direction (upwards), for example when using Find Prev.

      Note: An existing selection at cursor position is taken into account by expanding/reducing the selection to end of found string or bookmark.
      Best regards from an UC/UE/UES for Windows user from Austria

      3

        Aug 24, 2009#3

        Thanks for your response Mofi. After some experimentation, I found that I could do this easily with a macro as long as I want to move the cursor from the top of a selection to the bottom:

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        Find Select SelectText "^s"
        This relies on a UltraEdit's behaviour of placing the cursor after a found string, which means that a different solution is required to move the cursor from the bottom to the top of a selection. Here's what I have so far:

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        Cut
        "¬"
        Paste
        StartSelect
        Find Up Select "¬"
        (Replace "¬" with any character you don't intend to use in the type of file you're working with.)

        This relies on the same behaviour of placing the cursor after a found string. But it's a real kludge, because the selected text now starts with an extraneous "¬". Any ideas?

        344
        MasterMaster
        344

          Aug 24, 2009#4

          There is the option to use "persistent selections" (Edit menu). As far as I know, it is not possible in macros. (It does not record it).
          But I made it to jump to the beginning of a persistent selection by pressing ctrl+LMB at the start of the selection.
          see online help about it:

          Code: Select all

          "The anchor point for the active selection may be changed by holding down the CTRL key and left-clicking with the mouse at the desired file position. "
          Maybe this one is for you
          Normally using all newest english version incl. each hotfix. Win 10 64 bit

          6,675585
          Grand MasterGrand Master
          6,675585

            Aug 25, 2009#5

            Code: Select all

            InsertMode
            ColumnModeOff
            HexOff
            Find SelectText "^s"
            is working only for selection with up to 30.000 bytes. If the selection is larger, it will not work.

            Code: Select all

            InsertMode
            ColumnModeOff
            HexOff
            Clipboard 9
            Cut
            ToggleBookmark
            Paste
            ClearClipboard
            Clipboard 0
            PreviousBookmarkSelect
            ToggleBookmark
            works for moving the cursor from end to start of a selection if the configuration setting Bookmark column with line at Advanced - Configuration - Editor - Bookmarks.

            It would be maybe better to code that cursor moving in selection commands with a script. With a script you can get and store the current line and column number in variables and get also the current selection into a string variable. Then you can count how many line endings are in the string and how many characters are selected in the last line of the selection. With that data you can calculate the line and column number of the opposite end of the selection. Now you can unselect the selection set the cursor to correct position and use command gotoLineSelect to select to the other position. The big advantage of a script using the described method is that nearly no limit exists (as long as you have not hundreds of MBs selected) and no undo steps are produced.
            Best regards from an UC/UE/UES for Windows user from Austria

            3

              Re: Moving cursor to opposite end of a selection [SOLVED]

              Sep 04, 2009#6

              Thanks Mofi, that's absolutely fine for my purposes.

              In fact, I've since found out that the Vim editor does just what I wanted (when in Visual mode, you can hit 'o' to move the cursor to the opposite end of a selection), as well as a range of other powerful movement commands. I've just installed gVim (the graphical version of Vim) and I think I'm much more comfortable with it. As a very keyboard-driven user, the case may be that UltraEdit simply isn't quite the right editor for me.

              Regardless, thank you very much for the assistance you've given me in this thread!