resize

abstract fun resize(newWidth: Int, newHeight: Int, oldScrollbackOffset: Int = 0): Pair<Int, Int>

Resizes the terminal to newWidth x newHeight.

Existing content is reflowed to the new width. The cursor is relocated to the corresponding position in the reflowed content. Scrollback history is preserved within the configured capacity. Both the primary and alternate grids are resized, and both screen buffers reset their scroll regions to the full viewport. Tab stops are resized non-destructively: surviving custom stops are preserved, stops past the new width are dropped, and any newly exposed columns receive the default 8-column VT rhythm. Saved-cursor state is clamped to the new bounds.

Return

A Pair of (newScrollbackOffset, newHistorySize), allowing the caller to re-anchor a scrollback viewport that was active at oldScrollbackOffset before the reflow.

Parameters

newWidth

New terminal width in cells. Must be > 0.

newHeight

New terminal height in rows. Must be > 0.

oldScrollbackOffset

The active scrollback offset before the resize.

Throws

if either dimension is <= 0.