Options
All
  • Public
  • Public/Protected
  • All
Menu

A search-and-replace engine for editor instances. This implements the code that is common to quick searches and more complex searches. This object is responsible for maintaining a search position in the document, and replacing hits as required.

Hierarchy

  • SearchReplace

Index

Constructors

constructor

Properties

Private caretManager

caretManager: CaretManager

Private editor

editor: Editor

The editor for which we are searching.

Private highlight

highlight: Element | undefined

Private lastMatch

lastMatch: DLocRange | null = null

Private scroller

scroller: Scroller

The scroller holding the document.

Private search

search: Search

Accessors

canReplace

  • get canReplace(): boolean
  • Whether we can replace the current hit. If there is no hit, then this is false. If the hit is somehow collapsed, this is also false. Otherwise, the hit must be a well-formed range.

    Returns boolean

current

  • get current(): DLocRange | undefined | null

Methods

clearHighlight

  • clearHighlight(): void

Private getDirectionalEdge

Private getDirectionalEnd

Private getDirectionalStart

next

replace

  • replace(value: string): void

setCaretToMatch

  • setCaretToMatch(): void

Private updateHighlight

  • updateHighlight(): void

updatePattern

  • Update the pattern to a new value. Calling this method attempts to update the current hit first, and may move in the direction of the search if updating the current hit is not possible. This updates current.

    Parameters

    • value: string

      The new pattern value.

    • options: SearchOptions

      The search options.

    Returns void

Generated using TypeDoc