4 unsigned short _COLS = 80;
5 unsigned short _LINES = 25;
7 static void ansiscr_init ( struct _curses_screen *scr __unused ) {
10 static void ansiscr_exit ( struct _curses_screen *scr __unused ) {
13 static void ansiscr_movetoyx ( struct _curses_screen *scr __unused,
14 unsigned int y, unsigned int x ) {
15 /* ANSI escape sequence to update cursor position */
16 printf ( "\033[%d;%dH", ( y + 1 ), ( x + 1 ) );
19 static void ansiscr_putc ( struct _curses_screen *scr, chtype c ) {
20 unsigned int character = ( c & A_CHARTEXT );
21 attr_t attrs = ( c & ( A_ATTRIBUTES | A_COLOR ) );
22 int bold = ( attrs & A_BOLD );
23 attr_t cpair = PAIR_NUMBER ( attrs );
27 if ( attrs != scr->attrs ) {
29 pair_content ( cpair, &fcol, &bcol );
30 /* ANSI escape sequence to update character attributes */
31 printf ( "\033[0;%d;3%d;4%dm", ( bold ? 1 : 22 ), fcol, bcol );
33 putchar ( character );
36 static int ansiscr_getc ( struct _curses_screen *scr __unused ) {
40 static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
44 SCREEN _ansi_screen = {
47 .movetoyx = ansiscr_movetoyx,