move cursor to end of selection

move cursor to end of selection

4
NewbieNewbie
4

    Jun 29, 2007#1

    Does anyone know how to move the cursor to the end of the current selection?

    I want to do a findReplace.find, but leave the cursor at the end of the selection.

    When I do an ordinary find/findnext in the editor (F3 key), the cursor is left at the end of the selection. But if I use findReplace.find within a .js script, the cursor is left at the beginning of the selecion.

    344
    MasterMaster
    344

      Jun 29, 2007#2

      I thought sth. like this would do the job:

      Code: Select all

      UltraEdit.activeDocument.findReplace.find("WHATER_YOU_WANT");
      //unmark
      UltraEdit.activeDocument.key("RIGHT ARROW");
      UltraEdit.activeDocument.key("LEFT ARROW");
      but I think there is a bug. When I start the script It finds "WHATER_YOU_WANT" and then loses focus completely. (Focus is in scripting-window).
      Can you confirm this ?

      rds Bego
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      21
      Basic UserBasic User
      21

        Jun 29, 2007#3

        I think the easiest way is

        Code: Select all

        UltraEdit.activeDocument.cut();
        UltraEdit.activeDocument.paste();
        

        262
        MasterMaster
        262

          Jun 29, 2007#4

          Spooky!!!

          I used Begos simple scripting find:

          Code: Select all

          UltraEdit.activeDocument.findReplace.find("WHATER_YOU_WANT");
          and as UltraBoG described, the cursor is in the beginning of the selection.

          And here is the spooky part - add a ueReOn:

          Code: Select all

          UltraEdit.ueReOn();
          UltraEdit.activeDocument.findReplace.find("WHATER_YOU_WANT");
          even though we're not using Regex, suddenly the cursor is at the end of the selection. Go figure.

          Default regex engine in scripting is perl, so if I add

          Code: Select all

          UltraEdit.perlReOn();
          UltraEdit.activeDocument.findReplace.find("WHATER_YOU_WANT");
          again the cursor is at the beginning. Hmmm.

          (btw in both cases I also tested with "UltraEdit.activeDocument.findReplace.regExp=false;" just to be sure regex was not on. Same result).