diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/include/ghostty/vt/formatter.h | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/include/ghostty/vt/formatter.h')
| -rw-r--r-- | vendor/libghostty-vt/include/ghostty/vt/formatter.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/include/ghostty/vt/formatter.h b/vendor/libghostty-vt/include/ghostty/vt/formatter.h index 5cdcd11a..fd593b13 100644 --- a/vendor/libghostty-vt/include/ghostty/vt/formatter.h +++ b/vendor/libghostty-vt/include/ghostty/vt/formatter.h @@ -11,6 +11,7 @@ #include <stddef.h> #include <stdint.h> #include <ghostty/vt/allocator.h> +#include <ghostty/vt/io.h> #include <ghostty/vt/selection.h> #include <ghostty/vt/types.h> #include <ghostty/vt/terminal.h> @@ -138,6 +139,30 @@ GHOSTTY_API GhosttyResult ghostty_formatter_terminal_new( GhosttyFormatterTerminalOptions options); /** + * Run the formatter and stream output to a writer. + * + * Each call formats the current terminal state and invokes the writer + * synchronously as output becomes available. The callback may be called more + * than once and must not call formatter or terminal APIs using the same + * formatter or its terminal. + * + * If an error occurs, the writer may already contain a partial formatted + * output. The operation cannot be resumed from that partial output. This + * function does not flush or make the caller's destination durable. + * + * @param formatter The formatter handle (must not be NULL) + * @param writer Destination writer whose write callback must not be NULL + * @return GHOSTTY_SUCCESS on success, GHOSTTY_IO_ERROR if the writer rejects + * output, GHOSTTY_LIMIT_EXCEEDED if output accounting overflows, or + * GHOSTTY_INVALID_VALUE if an argument is invalid + * + * @ingroup formatter + */ +GHOSTTY_API GhosttyResult ghostty_formatter_format( + GhosttyFormatter formatter, + GhosttyWriter writer); + +/** * Run the formatter and produce output into the caller-provided buffer. * * Each call formats the current terminal state. Pass NULL for buf to @@ -171,6 +196,8 @@ GHOSTTY_API GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatte * The caller is responsible for freeing the returned buffer with * ghostty_free(), passing the same allocator (or NULL for the default) * that was used for the allocation. + * Empty output returns GHOSTTY_SUCCESS with *out_ptr set to NULL and + * *out_len set to zero. This result can be passed to ghostty_free(). * * @param formatter The formatter handle (must not be NULL) * @param allocator Pointer to allocator, or NULL to use the default allocator |
