LavaUI docs

struct TextSearch

Swift

struct TextSearch

Find-in-buffer: match locations plus which one is current.

Deliberately holds no reference to the buffer. Matches are recomputed when asked rather than kept in sync with edits, because a stale match range is worse than no match at all — it would highlight, and navigate to, text that has moved.

Sources/LavaText/TextSearch.swift:9

Constructors

init()

Not documented.

Sources/LavaText/TextSearch.swift:16

Properties

var caseSensitive: Bool { get }

Not documented.

Sources/LavaText/TextSearch.swift:11

var count: Int { get }

Not documented.

Sources/LavaText/TextSearch.swift:19

var current: Range<Int>? { get }

Not documented.

Sources/LavaText/TextSearch.swift:21

var currentIndex: Int? { get }

Not documented.

Sources/LavaText/TextSearch.swift:14

var isActive: Bool { get }

Not documented.

Sources/LavaText/TextSearch.swift:18

var matches: [Range<Int>] { get }

Character offsets over the whole buffer.

Sources/LavaText/TextSearch.swift:13

var query: String { get }

Not documented.

Sources/LavaText/TextSearch.swift:10

Methods

mutating func clear()

Not documented.

Sources/LavaText/TextSearch.swift:41

mutating func find(_ query: String, in text: String, caseSensitive: Bool = false, near caret: Int = 0)

Recomputes matches. near biases the initial selection to the match at or after the caret, so opening find jumps forward rather than back to the top of the buffer.

Sources/LavaText/TextSearch.swift:29