Skip to main content

ghostty_formatter_format_buf

Function ghostty_formatter_format_buf 

Source
pub unsafe extern "C" fn ghostty_formatter_format_buf(
    formatter: Formatter,
    buf: *mut u8,
    buf_len: usize,
    out_written: *mut usize,
) -> Type
Expand 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.

               or the required size on failure