diff options
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 */ |
