Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / COLLECTIONS AND INTERACTION
ScrollState
Application-owned scrolling along one axis, measured in terminal cells.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Members on this page
Feature guides and release status
ScrollState
struct ScrollStateConforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.
Application-owned scrolling along one axis, measured in terminal cells.
Source · ScrollState.swift:2contentLength
var contentLength: Int { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:3viewportLength
var viewportLength: Int { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:4offset
var offset: Int { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:5followsEnd
var followsEnd: Bool { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:6maximumOffset
var maximumOffset: Int { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:8isAtStart
var isAtStart: Bool { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:9isAtEnd
var isAtEnd: Bool { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:10visibleRange
var visibleRange: Range<Int> { get }A public field of this type. Its value type and mutability are shown in the declaration.
Source · ScrollState.swift:11init(contentLength:viewportLength:offset:followsEnd:)
init(contentLength: Int = 0, viewportLength: Int = 0, offset: Int = 0, followsEnd: Bool = false)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (4)
contentLength- Argument type and any default are shown in the declaration; see the behavior notes above.
viewportLength- Argument type and any default are shown in the declaration; see the behavior notes above.
offset- Offset in extended grapheme clusters.
followsEnd- Argument type and any default are shown in the declaration; see the behavior notes above.
update(contentLength:viewportLength:)
mutating func update(contentLength: Int, viewportLength: Int)Updates metrics after content changes or resize, preserving the offset or following the end.
Parameters (2)
contentLength- Argument type and any default are shown in the declaration; see the behavior notes above.
viewportLength- Argument type and any default are shown in the declaration; see the behavior notes above.
scroll(to:)
mutating func scroll(to offset: Int)Moves to a clamped cell offset.
Moving away from the end stops automatic following.
Parameters (1)
to- Argument type and any default are shown in the declaration; see the behavior notes above.
scroll(by:)
mutating func scroll(by cells: Int)Moves by signed cell/row distance, clamping to the content range.
Parameters (1)
by- Argument type and any default are shown in the declaration; see the behavior notes above.
scrollPage(by:)
mutating func scrollPage(by pages: Int)Moves by a signed number of viewport lengths, clamped to the content range.
Parameters (1)
by- Argument type and any default are shown in the declaration; see the behavior notes above.
scrollToEnd(follow:)
mutating func scrollToEnd(follow: Bool = false)Moves to maximumOffset and optionally follows future growth at the end.
Parameters (1)
follow- Argument type and any default are shown in the declaration; see the behavior notes above.
reveal(_:padding:)
mutating func reveal(_ range: Range<Int>, padding: Int = 0)Reveals a cell range; a range larger than the viewport is aligned to its start.
Parameters (2)
range- Argument type and any default are shown in the declaration; see the behavior notes above.
padding- Argument type and any default are shown in the declaration; see the behavior notes above.
handle(_:axis:wheelStep:)
@discardableResult mutating func handle(_ event: InputEvent, axis: Direction = .vertical, wheelStep: Int = 3) -> BoolOptional default navigation.
The caller routes only events belonging to this viewport.
Parameters (3)
event- Argument type and any default are shown in the declaration; see the behavior notes above.
axis- Argument type and any default are shown in the declaration; see the behavior notes above.
wheelStep- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Bool.