Ace API Reference
    Preparing search index...

    Class Selection

    Index

    Constructors

    • Creates a new Selection object.

      Parameters

      • session: EditSession

        The session to use

      Returns Selection

    Properties

    $anchorChanged: boolean
    $cursorChanged: boolean
    $desiredColumn: any
    $isEmpty: boolean
    $keepDesiredColumnOnChange: boolean
    $silent: boolean
    anchor: Anchor
    cursor: Anchor
    doc: Document
    getSelectionAnchor: () => Ace.Point

    Left for backward compatibility

    Type declaration

      • (): Ace.Point
      • Returns an object containing the row and column of the calling selection anchor.

        Returns Ace.Point

    lead: Anchor
    session: EditSession
    setSelectionAnchor: (row: number, column: number) => void

    Left for backward compatibility

    Type declaration

      • (row: number, column: number): void
      • Sets the row and column position of the anchor. This function also emits the 'changeSelection' event.

        Parameters

        • row: number

          The new row

        • column: number

          The new column

        Returns void

    setSelectionRange: (range: Ace.IRange, reverse?: boolean) => void

    Type declaration

      • (range: Ace.IRange, reverse?: boolean): void
      • Sets the selection to the provided range.

        Parameters

        • range: Ace.IRange

          The range of text to select

        • Optionalreverse: boolean

          Indicates if the range should go backwards (true) or not

        Returns void

    Methods

    • Parameters

      • anchorRow: number
      • anchorColumn: number
      • cursorRow: number
      • cursorColumn: number

      Returns void

    • Parameters

      • rightOfCursor: any

      Returns number

    • [Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.]{: #Selection.clearSelection}

      Returns void

    • Parameters

      • range: Range & { desiredColumn?: number }

      Returns void

    • Returns an object containing the row and column of the calling selection anchor.

      Returns Ace.Point

    • Parameters

      • row: any
      • excludeLastChar: any

      Returns Range

    • [Returns the [[Range]] for the selected text.]{: #Selection.getRange}

      Returns Range

    • Saves the current cursor position and calls func that can change the cursor postion. The result is the range of the starting and eventual cursor position. Will reset the cursor position.

      Parameters

      • func: Function

        The callback that should change the cursor position

      Returns Range

    • Returns an object containing the row and column of the calling selection lead.

      Returns any

    • Moves the selection to highlight the entire word.

      Parameters

      • row: any
      • column: any

      Returns Range

    • Returns true if the selection is going backwards in the document.

      Returns boolean

    • Returns true if the selection is empty.

      Returns boolean

    • Returns true if the selection is a multi-line.

      Returns boolean

    • Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.

      Parameters

      • rows: number

        The number of rows to move by

      • chars: number

        The number of characters to move by

      Returns void

    • Moves the cursor to the end of the file.

      Returns void

    • Moves the cursor to the start of the file.

      Returns void

    • Moves the cursor to the end of the line.

      Returns void

    • Moves the cursor to the start of the line.

      Returns void

    • Moves the cursor to the word on the left.

      Returns void

    • Moves the cursor to the word on the right.

      Returns void

    • Moves the cursor right one column.

      Returns void

    • Moves the cursor to the row and column provided. [If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc}

      Parameters

      • row: number

        The row to move to

      • column: number

        The column to move to

      • OptionalkeepDesiredColumn: boolean

        [If true, the cursor move does not respect the previous column]{: #preventUpdateBool}

      Returns void

    • Moves the selection to the position indicated by its row and column.

      Parameters

      • position: Ace.Point

        The position to move to

      Returns void

    • Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc}

      Parameters

      • row: number

        The row to move to

      • column: number

        The column to move to

      • keepDesiredColumn: boolean

        {:preventUpdateBool}

      Returns void

    • Moves the selection cursor to the indicated row and column.

      Parameters

      • row: number

        The row to select to

      • column: number

        The column to select to

      Returns void

    • Moves the selection cursor to the row and column indicated by pos.

      Parameters

      • pos: any

        An object containing the row and column

      Returns void

    • Selects a word, including its right whitespace.

      Returns void

    • Moves the selection to the end of the file.

      Returns void

    • Moves the selection to the start of the file.

      Returns void

    • Moves the selection to the end of the current line.

      Returns void

    • Moves the selection to the beginning of the current line.

      Returns void

    • Moves the selection right one column.

      Returns void

    • Moves the selection cursor to the indicated row and column.

      Parameters

      • row: number

        The row to select to

      • column: number

        The column to select to

      Returns void

    • Moves the selection cursor to the row and column indicated by pos.

      Parameters

      • pos: Ace.Point

        An object containing the row and column

      Returns void

    • Moves the selection to the first word on the left.

      Returns void

    • Moves the selection to the first word on the right.

      Returns void

    • Sets the row and column position of the anchor. This function also emits the 'changeSelection' event.

      Parameters

      • row: number

        The new row

      • column: number

        The new column

      Returns void

    • Sets the selection to the provided range.

      Parameters

      • range: Ace.IRange

        The range of text to select

      • Optionalreverse: boolean

        Indicates if the range should go backwards (true) or not

      Returns void

    • Parameters

      • Optionalrange: Range & { desiredColumn?: number }

      Returns Range & { desiredColumn?: number }

    • Returns true if moving the character next to the cursor in the specified direction is a soft tab.

      Parameters

      • cursor: Ace.Point

        the current cursor position

      • tabSize: number

        the tab size

      • direction: number

        1 for right, -1 for left

      Returns boolean