libghostty-vt 1.0.0
Loading...
Searching...
No Matches
formatter.h
Go to the documentation of this file.
1
6
7#ifndef GHOSTTY_VT_FORMATTER_H
8#define GHOSTTY_VT_FORMATTER_H
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
14#include <ghostty/vt/io.h>
16#include <ghostty/vt/types.h>
17#include <ghostty/vt/terminal.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
43
75typedef uint32_t GhosttyFormatterExtras;
76
78#define GHOSTTY_FORMATTER_EXTRA_PALETTE (1u << 0)
80#define GHOSTTY_FORMATTER_EXTRA_MODES (1u << 1)
82#define GHOSTTY_FORMATTER_EXTRA_SCROLLING_REGION (1u << 2)
84#define GHOSTTY_FORMATTER_EXTRA_TABSTOPS (1u << 3)
86#define GHOSTTY_FORMATTER_EXTRA_PWD (1u << 4)
88#define GHOSTTY_FORMATTER_EXTRA_KEYBOARD (1u << 5)
90#define GHOSTTY_FORMATTER_EXTRA_CURSOR (1u << 6)
92#define GHOSTTY_FORMATTER_EXTRA_STYLE (1u << 7)
94#define GHOSTTY_FORMATTER_EXTRA_HYPERLINK (1u << 8)
96#define GHOSTTY_FORMATTER_EXTRA_PROTECTION (1u << 9)
98#define GHOSTTY_FORMATTER_EXTRA_KITTY_KEYBOARD (1u << 10)
100#define GHOSTTY_FORMATTER_EXTRA_CHARSETS (1u << 11)
101
103#define GHOSTTY_FORMATTER_EXTRAS_NONE 0u
104
106#define GHOSTTY_FORMATTER_EXTRAS_ALL 0xFFFu
107
113#define GHOSTTY_FORMATTER_EXTRAS_DEFAULT \
114 (GHOSTTY_FORMATTER_EXTRA_PALETTE | GHOSTTY_FORMATTER_EXTRA_STYLE | \
115 GHOSTTY_FORMATTER_EXTRA_HYPERLINK)
116
141typedef enum GHOSTTY_ENUM_TYPED {
144
152
163
174
205
213
214 GHOSTTY_FORMATTER_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
216
235 const GhosttyAllocator* allocator,
236 GhosttyFormatter* formatter,
237 GhosttyTerminal terminal);
238
274 const void* value);
275
300 void* out);
301
323 GhosttyFormatter formatter,
324 GhosttyWriter writer);
325
362 uint8_t* buf,
363 size_t buf_len,
364 size_t* out_written);
365
389 const GhosttyAllocator* allocator,
390 uint8_t** out_ptr,
391 size_t* out_len);
392
403GHOSTTY_API void ghostty_formatter_free(GhosttyFormatter formatter);
404
406
407#ifdef __cplusplus
408}
409#endif
410
411#endif /* GHOSTTY_VT_FORMATTER_H */
GhosttyResult
Definition types.h:143
#define GHOSTTY_ENUM_TYPED
Definition types.h:124
GHOSTTY_API GhosttyResult ghostty_formatter_format_alloc(GhosttyFormatter formatter, const GhosttyAllocator *allocator, uint8_t **out_ptr, size_t *out_len)
GhosttyFormatterOption
Definition formatter.h:141
GHOSTTY_API GhosttyResult ghostty_formatter_terminal_new(const GhosttyAllocator *allocator, GhosttyFormatter *formatter, GhosttyTerminal terminal)
GHOSTTY_API GhosttyResult ghostty_formatter_set(GhosttyFormatter formatter, GhosttyFormatterOption option, const void *value)
uint32_t GhosttyFormatterExtras
Definition formatter.h:75
GHOSTTY_API void ghostty_formatter_free(GhosttyFormatter formatter)
GHOSTTY_API GhosttyResult ghostty_formatter_get(GhosttyFormatter formatter, GhosttyFormatterOption option, void *out)
GHOSTTY_API GhosttyResult ghostty_formatter_format(GhosttyFormatter formatter, GhosttyWriter writer)
GHOSTTY_API GhosttyResult ghostty_formatter_format_buf(GhosttyFormatter formatter, uint8_t *buf, size_t buf_len, size_t *out_written)
struct GhosttyFormatterImpl * GhosttyFormatter
Definition types.h:304
@ GHOSTTY_FORMATTER_OPT_TRIM
Definition formatter.h:173
@ GHOSTTY_FORMATTER_OPT_EMIT
Definition formatter.h:151
@ GHOSTTY_FORMATTER_OPT_UNWRAP
Definition formatter.h:162
@ GHOSTTY_FORMATTER_OPT_EXTRAS
Definition formatter.h:212
@ GHOSTTY_FORMATTER_OPT_SELECTION
Definition formatter.h:204
@ GHOSTTY_FORMATTER_OPT_INVALID
Definition formatter.h:143
struct GhosttyTerminalImpl * GhosttyTerminal
Definition types.h:196