Ace API Reference
    Preparing search index...

    Class Range

    This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogous to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.

    Index

    Constructors

    • Creates a new Range object with the given starting and ending rows and columns.

      Parameters

      • OptionalstartRow: number

        The starting row

      • OptionalstartColumn: number

        The starting column

      • OptionalendRow: number

        The ending row

      • OptionalendColumn: number

        The ending column

      Returns Range

    Properties

    cursor?: Ace.Point
    end: Ace.Point
    id?: number
    isBackwards?: boolean
    start: Ace.Point

    Methods

    • Returns the part of the current Range that occurs within the boundaries of firstRow and lastRow as a new Range object.

      Parameters

      • firstRow: number

        The starting row

      • lastRow: number

        The ending row

      Returns Range

    • Compares the row and column with the starting and ending [[Point]]'s of the calling range.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns number

      This method returns one of the following numbers:

      • 1 if row is greater than the calling range
      • -1 if row is less then the calling range
      • 0 otherwise

      If the starting row of the calling range is equal to row, and:

      • column is greater than or equal to the calling range's starting column, this returns 0
      • Otherwise, it returns -1

      If the ending row of the calling range is equal to row, and:

      • column is less than or equal to the calling range's ending column, this returns 0
      • Otherwise, it returns 1
    • Compares the row and column with the starting and ending [[Point]]'s of the calling range.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns number

      This method returns one of the following numbers:

      • 1 if calling range's ending column and calling range's ending row are equal row and column.
      • Otherwise, it returns the value after calling [[Range.compare compare()]].
    • Compares the row and column with the start and end [[Point]]'s of the calling range.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns number

      This method returns one of the following numbers:

      • 1 if the ending row of the calling range is equal to row, and the ending column of the calling range is equal to column
      • -1 if the starting row of the calling range is equal to row, and the starting column of the calling range is equal to column
      • Otherwise, it returns the value after calling [[Range.compare compare()]].
    • Compares the row and column of p with the starting and ending [[Point]]'s of the calling range (by calling [[Range.compare]]).

      Parameters

      Returns number

    • Compares this range (A) with another range (B).

      Parameters

      Returns number

      This method returns one of the following numbers:

      • -2: (B) is in front of (A), and doesn't intersect with (A)
      • -1: (B) begins before (A) but ends inside of (A)
      • 0: (B) is completely inside of (A)
      • +1: (B) begins inside of (A) but ends outside of (A)
      • +2: (B) is after (A) and doesn't intersect with (A)
      • 42: FTW state: (B) ends in (A) but starts outside of (A)
    • Compares the row and column with the starting and ending [[Point]]'s of the calling range.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns number

      This method returns one of the following numbers:

      • -1 if calling range's starting column and calling range's starting row are equal row and column
      • Otherwise, it returns the value after calling [[Range.compare compare()]].
    • Returns true if the row and column provided are within the given range. This can better be expressed as returning true if:

         this.start.row <= row <= this.end.row &&
      this.start.column <= column <= this.end.column

      Parameters

      • row: number

        A row to check for

      • column: number

        A column to check for

      Returns boolean

    • Checks the start and end [[Point]]'s of range and compares them to the calling range. Returns true if the range is contained within the caller's range.

      Parameters

      Returns boolean

    • Changes the row and column for the calling range for both the starting and ending [[Point]]'s.

      Parameters

      • row: number

        A new row to extend to

      • column: number

        A new column to extend to

      Returns Range

      The original range with the new row

    • Returns true if the row and column are within the given range.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns boolean

    • Returns true if the row and column are within the given range's ending [[Point]].

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns boolean

    • Returns true if the row and column are within the given range's starting [[Point]].

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns boolean

    • Returns true if the calling range is empty (starting [[Point]] == ending [[Point]]).

      Returns boolean

    • Returns true if the caller's ending row is the same as row, and if the caller's ending column is the same as column.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns boolean

    • Returns true if and only if the starting row and column, and ending row and column, are equivalent to those given by range.

      Parameters

      Returns boolean

    • Returns true if the caller's starting row is the same as row, and if the caller's starting column is the same as column.

      Parameters

      • row: number

        A row to compare with

      • column: number

        A column to compare with

      Returns boolean

    • Experimental

      Shift the calling range by row and column values.

      Parameters

      • row: number
      • column: number

      Returns void

    • Sets the starting row and column for the range.

      Parameters

      • row: number | Ace.Point

        A row to set

      • Optionalcolumn: number

        A column to set

      Returns void

    • Sets the starting row and column for the range.

      Parameters

      • row: number | Ace.Point

        A row to set

      • Optionalcolumn: number

        A column to set

      Returns void

    • Given the current Range, this function converts those starting and ending [[Point]]'s into screen positions, and then returns a new Range object.

      Parameters

      • session: EditSession

        The EditSession to retrieve coordinates from

      Returns Range

    • Returns a string containing the range's row and column information, given like this:

         [start.row/start.column] -> [end.row/end.column]
      

      Returns string