KetraTerm
API · DevelopmentAll versions

TerminalViewportState

data class TerminalViewportState(val historySize: Int, val scrollbackOffset: Double, val renderOffset: Int, val visibleRows: Int, val requestedRows: Int, val visualScrollOffsetPixels: Double = scrollbackOffset, val visualScrollRangePixels: Int = historySize, val viewportHeightPixels: Int = visibleRows, val contentHeightPixels: Int = requestedRows, val cellHeightPixels: Int = 1)

Host-facing snapshot of the terminal viewport's scrollback position.

0.0 means the live viewport, and larger values move farther back into history. In gutter and undecorated modes each scroll slot is a terminal row. Divider mode counts both text rows and one-cell-high prompt bands in presentation coordinates. Hosts that use top-origin scrollbars can invert this value in their adapter without changing terminal rendering policy.

After session closure, zero identifies the bottom of the retained presentation. The history size includes final grid rows hidden above a shorter component. These presentation coordinates do not change the session's grid or history.

Constructors

Link copied to clipboard
constructor(historySize: Int, scrollbackOffset: Double, renderOffset: Int, visibleRows: Int, requestedRows: Int, visualScrollOffsetPixels: Double = scrollbackOffset, visualScrollRangePixels: Int = historySize, viewportHeightPixels: Int = visibleRows, contentHeightPixels: Int = requestedRows, cellHeightPixels: Int = 1)

Properties

Link copied to clipboard

fixed terminal row height in pixels.

Link copied to clipboard

visual content height for the current render cache in pixels, or zero before the bound session publishes its first frame.

Link copied to clipboard

number of presentation slots available above the live viewport.

Link copied to clipboard

Whether the viewport is following live terminal output.

Link copied to clipboard

whole-row offset requested from the render cache. This is a terminal-native source offset; prompt bands do not occupy source rows.

Link copied to clipboard

number of rows requested from the render cache, including smooth-scroll overscan when required.

Link copied to clipboard

precise visual offset from the live viewport. Fractional values exist only during smooth animation between integer row destinations; completed viewports are row-aligned.

Link copied to clipboard

visual viewport height in pixels.

Link copied to clipboard

terminal grid capacity computed from component height and cell metrics, before prompt bands.

Link copied to clipboard

precise pixel offset from the live bottom.

Link copied to clipboard

maximum presentation pixel offset from the live bottom.