/* * Copyright (c) 2021 joshua stein * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __ANSI_H__ #define __ANSI_H__ #include "session.h" #define ESC 0x1b enum { ANSI_RESET = 1, ANSI_BOLD, ANSI_UNDERLINE, ANSI_REVERSE, ANSI_CLEAR_SCREEN, ANSI_ERASE_LINE, ANSI_BACKSPACE, ANSI_SAVE_CURSOR, ANSI_RESTORE_SAVED_CURSOR, /* these require N args */ ANSI_DOWN_N, ANSI_FORWARD_N, ANSI_BACK_N, ANSI_UP_N, ANSI_COL_N, ANSI_CURSOR_LINE_COL, ANSI_INSERT_LINES_N, ANSI_DELETE_LINES_N, ANSI_END = -1 }; char * ansi(struct session *s, ...); const char * ansi_bold(struct session *s); const char * ansi_reset(struct session *s); size_t ansi_strip(char *inp, char **outp); void ansi_probe_screen_size(struct session *s); #endif /* __ANSI_H__ */