diff options
| author | info@mode42.com <info@mode42.com> | 2026-08-08 03:54:55 +0000 |
|---|---|---|
| committer | info@mode42.com <info@mode42.com> | 2026-08-08 03:54:55 +0000 |
| commit | 20cb29c2f8c5c87bc590896854a20b1473ceb358 (patch) | |
| tree | 2857f41513a56ad41af97b57362639298aa7f033 /include/hybbx/terminal.h | |
#2
Diffstat (limited to 'include/hybbx/terminal.h')
| -rw-r--r-- | include/hybbx/terminal.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/hybbx/terminal.h b/include/hybbx/terminal.h new file mode 100644 index 0000000..fec0871 --- /dev/null +++ b/include/hybbx/terminal.h @@ -0,0 +1,39 @@ +#ifndef HYBBX_TERMINAL_H +#define HYBBX_TERMINAL_H + +#include "hybbx/types.h" + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +struct hybbx_session; + +/** + * HyBBX uses a single terminal palette: light gray text on a black background. + * ANSI SGR: foreground 37, background 40. + */ +#define HYBBX_TERM_SGR_LIGHTGRAY_ON_BLACK "\033[37;40m" + +/** Clear screen and move cursor home (requires `traffic.ansi = yes`). */ +#define HYBBX_TERM_CLEAR_SCREEN "\033[2J\033[H" + +/** Apply the HyBBX terminal colors on a session (sent once at connect). */ +hybbx_result_t hybbx_term_init_session(struct hybbx_session *session); + +/** Clear the client screen (ANSI or plain newlines). */ +hybbx_result_t hybbx_term_clear_screen(struct hybbx_session *session); + +/** + * Copy @p src to @p dst without ANSI escape sequences (colors, cursor, etc.). + * @return length of written string excluding the terminator. + */ +size_t hybbx_term_copy_plain(const char *src, char *dst, size_t dst_size); + +#ifdef __cplusplus +} +#endif + +#endif /* HYBBX_TERMINAL_H */ |
