LavaUI docs

struct EditorPosition

Swift

struct EditorPosition

Where an editor was left: what it was scrolled to, and what was selected.

Character offsets rather than String.Index, because the point of saving this is to restore it into a different buffer state — a document swapped out and back, or a workspace reopened days later. An index into a string that no longer exists is not a position, it is a crash waiting for the wrong buffer; an offset is merely clamped.

Sources/LavaUI/EditorView.swift:124

Constructors

init(scrollX: Float = 0, scrollY: Float = 0, anchor: Int = 0, focus: Int = 0)

Not documented.

Sources/LavaUI/EditorView.swift:131

Properties

var anchor: Int

Selection ends, in character offsets. Equal means a plain caret.

Sources/LavaUI/EditorView.swift:128

var focus: Int

Not documented.

Sources/LavaUI/EditorView.swift:129

var scrollX: Float

Not documented.

Sources/LavaUI/EditorView.swift:125

var scrollY: Float

Not documented.

Sources/LavaUI/EditorView.swift:126

static let start: EditorPosition

Not documented.

Sources/LavaUI/EditorView.swift:138