resize method
Resizes the buffer to newWidth by newHeight terminal cells.
newWidth and newHeight must fit unsigned 32-bit values; violations
throw a pre-invocation RangeError before the positive-dimensions
ArgumentError.
Implementation
void resize(int newWidth, int newHeight) {
_checkValid();
_checkUnsignedAbi(newWidth, 0xFFFFFFFF, 'newWidth');
_checkUnsignedAbi(newHeight, 0xFFFFFFFF, 'newHeight');
if (newWidth <= 0 || newHeight <= 0) {
throw ArgumentError(
'Invalid dimensions: width and height must be greater than 0',
);
}
try {
_bindings.bufferResize(_ptr, newWidth, newHeight);
} finally {
// OpenTUI reallocates every cell array during resize. Existing typed
// list views must fail before their next read even if native resizing
// reports an error after partially mutating storage.
_validity.directAccessGeneration++;
}
}