KetraTerm
API · DevelopmentAll versions

tryUpdateViewportPixels

fun tryUpdateViewportPixels(columns: Int, rows: Int, pixelWidth: Int, pixelHeight: Int): Boolean

Updates text-area pixels only if the open session still has the expected grid.

Grid validation and metadata mutation share session serialization. Returns false without mutation when closure has begun, the grid differs, or a previous resize has not completed; callers can then use tryResizeViewport for a full resize. A successful update preserves content, selection anchors, and render generations. Subscribed notifications enter the ordered writer before this call returns.

Return

true if pixel metadata was admitted for the matching grid.

Parameters

columns

expected terminal column count; at least TerminalBuffers.MIN_WIDTH.

rows

expected positive terminal row count.

pixelWidth

nonnegative text-area width excluding padding; zero means unknown.

pixelHeight

nonnegative text-area height excluding padding; zero means unknown.