AmendHub

Download

jcs

/

subtext

/

ansi.h

 

(View History)

jcs   session: Don't run all session_printf formats through expand_template Latest amendment: 155 on 2022-06-17

1 /*
2 * Copyright (c) 2021 joshua stein <jcs@jcs.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __ANSI_H__
18 #define __ANSI_H__
19
20 #include "session.h"
21
22 #define ESC 0x1b
23
24 enum {
25 ANSI_RESET = 1,
26 ANSI_BOLD,
27 ANSI_UNDERLINE,
28 ANSI_REVERSE,
29
30 ANSI_CLEAR_SCREEN,
31 ANSI_ERASE_LINE,
32 ANSI_BACKSPACE,
33
34 ANSI_SAVE_CURSOR,
35 ANSI_RESTORE_SAVED_CURSOR,
36
37 /* these require N args */
38 ANSI_DOWN_N,
39 ANSI_FORWARD_N,
40 ANSI_BACK_N,
41 ANSI_UP_N,
42 ANSI_COL_N,
43 ANSI_CURSOR_LINE_COL,
44 ANSI_INSERT_LINES_N,
45 ANSI_DELETE_LINES_N,
46
47 ANSI_END = -1
48 };
49
50 char * ansi(struct session *s, ...);
51 const char * ansi_bold(struct session *s);
52 const char * ansi_reset(struct session *s);
53 size_t ansi_strip(char *inp, char **outp);
54 void ansi_probe_screen_size(struct session *s);
55
56 #endif /* __ANSI_H__ */