isPasteSafeBytes static method

bool isPasteSafeBytes(
  1. List<int> bytes
)

Returns whether raw UTF-8 bytes are safe to paste into a terminal.

Implementation

static bool isPasteSafeBytes(List<int> bytes) {
  final ptr = calloc<ffi.Uint8>(bytes.length);
  try {
    ptr.asTypedList(bytes.length).setAll(0, bytes);
    return bindings.ghostty_paste_is_safe(ptr.cast<ffi.Char>(), bytes.length);
  } finally {
    calloc.free(ptr);
  }
}