textBufferWriteUtf8Chunk method

int textBufferWriteUtf8Chunk(
  1. Pointer<TextBufferHandle> textBuffer,
  2. Pointer<Uint8> textBytes,
  3. int textLen,
  4. Color fg,
  5. Color bg,
  6. int attributes,
)

Appends textLen caller-owned persistent UTF-8 textBytes to textBuffer with fg/bg colors and packed attributes, returning the native write result. Throws FFIException on failure.

Implementation

int textBufferWriteUtf8Chunk(
  Pointer<TextBufferHandle> textBuffer,
  Pointer<Uint8> textBytes,
  int textLen,
  Color fg,
  Color bg,
  int attributes,
) => _guardAlloc('Failed to write text buffer UTF-8 chunk', (alloc) {
  final attrPtr = alloc<Uint8>();
  attrPtr[0] = attributes;

  return _generated.textBufferWriteChunk(
    textBuffer.cast(),
    textBytes,
    textLen,
    fg.toNative(alloc),
    bg.toNative(alloc),
    attrPtr,
  );
});