Selecting text

Selecting text

6
NewbieNewbie
6

    Apr 17, 2007#1

    Hello

    Does anyone know how to select an entire line without selecting the hard return at the end?

    selectLine() unfortunately selects the line and the return.

    There does not appear to be a key("SHIFT+END") command either.

    262
    MasterMaster
    262

      Apr 17, 2007#2

      Just do some basic javascript string manipulation after retrieving the selected line. Here is an example.

      Code: Select all

      String.prototype.nocrlf = function() { return this.replace(/[\r\n]/g, ""); };
      
      UltraEdit.activeDocument.selectLine();
      var line = UltraEdit.activeDocument.selection;
      UltraEdit.activeDocument.bottom();
      UltraEdit.activeDocument.write(line.nocrlf());
      UltraEdit.activeDocument.write("-----");
      
      I'm using prototype to add a new method to the string object. The method is some simple regexp.

      6
      NewbieNewbie
      6

        Apr 17, 2007#3

        Thanks jorrasdk, you are obviously a javascript "guru" :)

        My experience of javascript has come through UltraEdit!

        Jon