pub unsafe extern "C" fn ghostty_formatter_format_buf(
formatter: GhosttyFormatter_ptr,
buf: *mut u8,
buf_len: usize,
out_written: *mut usize,
) -> GhosttyResultExpand description
Run the formatter and produce output into the caller-provided buffer.
Each call formats the current terminal state. Pass NULL for buf to query the required buffer size without writing any output; in that case out_written receives the required size and the return value is GHOSTTY_OUT_OF_SPACE.
If the buffer is too small, returns GHOSTTY_OUT_OF_SPACE and sets out_written to the required size. The caller can then retry with a larger buffer.
@param formatter The formatter handle (must not be NULL) @param buf Pointer to the output buffer, or NULL to query size @param buf_len Length of the output buffer in bytes @param out_written Pointer to receive the number of bytes written, or the required size on failure @return GHOSTTY_SUCCESS on success, or an error code on failure
@ingroup formatter