Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • Range

Index

Constructors

constructor

  • new Range(startRow: Number, startColumn: Number, endRow: Number, endColumn: Number): Range
  • Creates a new Range object with the given starting and ending rows and columns.

    Parameters

    • startRow: Number

      The starting row

    • startColumn: Number

      The starting column

    • endRow: Number

      The ending row

    • endColumn: Number

      The ending column

    Returns Range

Properties

end

end: Point

start

start: Point

Methods

clipRows

  • clipRows(firstRow: number, lastRow: number): Range
  • 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

clone

collapseRows

  • Returns a range containing the starting and ending rows of the original range, but with a column value of 0.

    Returns Range

compare

  • compare(row: number, column: number): number
  • 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

compareEnd

  • compareEnd(row: number, column: number): number
  • 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 compare().

compareInside

  • compareInside(row: number, column: number): number
  • 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 compare().

comparePoint

  • comparePoint(p: Point): number

comparePoints

compareRange

  • compareRange(range: Range): number
  • Compares this range (A) with another range (B).

    related

    Range.compare

    Parameters

    • range: Range

      A range to compare with

    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) OR (A) is completely inside of (B)
    • +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)

compareStart

  • compareStart(row: number, column: number): number
  • 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 compare().

contains

  • contains(row: number, column: number): boolean
  • Returns true if the row and column provided are within the given range. This can better be expressed as returning true if: ```javascript

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

    this.start.column <= column <= this.end.column ```

    related

    Range.compare

    Parameters

    • row: number

      A row to check for

    • column: number

      A column to check for

    Returns boolean

containsRange

  • containsRange(range: Range): 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.

    related

    Range.comparePoint

    Parameters

    • range: Range

      A range to compare with

    Returns boolean

extend

  • extend(row: number, column: number): Range
  • 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

fromPoints

  • Creates and returns a new Range based on the start Point and end Point of the given parameters.

    Parameters

    • start: Point

      A starting point to use

    • end: Point

      An ending point to use

    Returns Range

inside

  • inside(row: number, column: number): boolean
  • Returns true if the row and column are within the given range.

    related

    Range.compare

    Parameters

    • row: number

      A row to compare with

    • column: number

      A column to compare with

    Returns boolean

insideEnd

  • insideEnd(row: number, column: number): boolean
  • Returns true if the row and column are within the given range's ending Point.

    related

    Range.compare

    Parameters

    • row: number

      A row to compare with

    • column: number

      A column to compare with

    Returns boolean

insideStart

  • insideStart(row: number, column: number): boolean
  • Returns true if the row and column are within the given range's starting Point.

    related

    Range.compare

    Parameters

    • row: number

      A row to compare with

    • column: number

      A column to compare with

    Returns boolean

intersects

  • intersects(range: Range): boolean
  • Returns true if passed in range intersects with the one calling this method.

    Parameters

    • range: Range

      A range to compare with

    Returns boolean

isEmpty

  • isEmpty(): boolean

isEnd

  • isEnd(row: number, column: number): 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

isEqual

  • isEqual(range: Range): 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

    • range: Range

      A range to check against

    Returns boolean

isMultiLine

  • isMultiLine(): boolean
  • Returns true if the range spans across multiple lines.

    Returns boolean

isStart

  • isStart(row: number, column: number): 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

moveBy

  • moveBy(row: number, column: number): void
  • Shift the calling range by row and column values.

    experimental

    Parameters

    • row: number
    • column: number

    Returns void

setEnd

  • setEnd(row: number, column: number): void
  • Sets the starting row and column for the range.

    Parameters

    • row: number

      A row to set

    • column: number

      A column to set

    Returns void

setStart

  • setStart(row: number, column: number): void
  • Sets the starting row and column for the range.

    Parameters

    • row: number

      A row to set

    • column: number

      A column to set

    Returns void

toScreenRange

  • 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

toString

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

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

    Returns string

Generated using TypeDoc