KetraTerm
API · DevelopmentAll versions

clearBuffer

Clears the active screen and its history without sending input to the connector.

Call off UI threads and outside a frame lease or output callback. Mutation admission orders this operation with output and resize, including active decoding. Admission succeeds before start and while running. Closure returns false without changing retained output. An operation admitted before closure can finish.

The cursor position, modes, pen, margins, tab stops, saved cursor, and inactive buffer remain unchanged. Pending wrap is cancelled. Blank cells use the current erase attributes. New line identities invalidate old anchors. Applied frames invalidate selection and refresh search. The selected shell producer receives TerminalShellIntegration.bufferCleared under mutation serialization. Host-owned metadata remains host-owned; its old line identities no longer resolve.

This operation has no position in the outbound queue and does not wait for pending writes. Parser state remains intact, including incomplete escape sequences and UTF-8 input. Collaborator failures propagate after any completed mutation; render invalidation still runs.

Return

true when clearing was admitted, or false when closure has begun.

Throws

on reentry from an output or clear callback.