blob: fec087172b6e7d1a981a9525d653e6081d67c01d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 */
|