19 #ifndef COLR_CONTROLS_H 20 #define COLR_CONTROLS_H 25 #define COLR_ESC "\x1b[" 26 #define COLR_ESC_LEN 3 37 #define colr_control(...) \ 39 colr_fprint(stdout, __VA_ARGS__); \ 49 #define colr_print_inplace(...) \ 51 colr_control(Colr_pos_save(), __VA_ARGS__, Colr_pos_restore()); \ 59 #define colr_print_overwrite(...) \ 61 colr_control(Colr_erase_line(ALL), Colr_move_column(1), __VA_ARGS__); \ 76 #define EraseMethod_to_str(method) ( \ 77 method == END ? "0" : \ 78 method == START ? "1" : \ 79 method == ALL_MOVE ? "2" : \ 80 method == ALL_ERASE ? "3" : \ 81 method == ALL_MOVE_ERASE ? "4" : \ 82 method == ALL ? "2" : \ 122 #endif // COLR_CONTROLS_H ColorResult * Colr_move_prev(unsigned int lines)
Returns an allocated ColorResult that will move the cursor up a number of lines, at the start of the ...
Definition: colr.controls.c:291
ColorResult * Colr_pos_restore(void)
Returns an allocated ColorResult that restores a previously saved cursor position when printed...
Definition: colr.controls.c:343
Clear cursor to the start of the line/screen (depending on erase function used).
Definition: colr.controls.h:91
Clear cursor to the end of the line/screen (depending on erase function used).
Definition: colr.controls.h:89
Clear all, and erase scrollback buffer.
Definition: colr.controls.h:95
Declarations for ColrC functions, enums, structs, etc.
EraseMethod
Methods to erase text.
Definition: colr.controls.h:87
ColorResult * Colr_cursor_hide(void)
Returns an allocated ColorResult that hides the cursor when printed.
Definition: colr.controls.c:41
ColorResult * Colr_pos_save(void)
Returns an allocated ColorResult that saves the cursor position when printed.
Definition: colr.controls.c:358
ColorResult * Colr_move_return(void)
Returns an allocated ColorResult that will move the cursor back to the beginning of the line with a c...
Definition: colr.controls.c:162
ColorResult * Colr_erase_display(EraseMethod method)
Returns an allocated ColorResult that will erase the display or part of the display when printed...
Definition: colr.controls.c:79
ColorResult * Colr_move_next(unsigned int lines)
Returns an allocated ColorResult that will move the cursor down a number of lines, at the start of the line, when printed.
Definition: colr.controls.c:239
ColorResult * Colr_move_pos(unsigned int line, unsigned int column)
Returns an allocated ColorResult that will position the cursor on the desired line and column when pr...
Definition: colr.controls.c:266
ColorResult * Colr_erase_line(EraseMethod method)
Returns an allocated ColorResult that will erase line or part of a line when printed.
Definition: colr.controls.c:122
This is an alias for ALL_MOVE, when using the erase_line functions.
Definition: colr.controls.h:101
ColorResult * Colr_move_forward(unsigned int columns)
Returns an allocated ColorResult that will move the cursor forward a number of columns when printed...
Definition: colr.controls.c:220
Clear all, and move home for display, or clear entire the line when doing a line erase.
Definition: colr.controls.h:93
Clear all, move home, and erase scrollback buffer.
Definition: colr.controls.h:99
ColorResult * Colr_cursor_show(void)
Returns an allocated ColorResult that shows the cursor when printed.
Definition: colr.controls.c:53
Holds a string (char*) that was definitely allocated by Colr.
Definition: colr.h:3018
ColorResult * Colr_move_back(unsigned int columns)
Returns an allocated ColorResult that will move the cursor back a number of columns when printed...
Definition: colr.controls.c:147
ColorResult * Colr_move_up(unsigned int lines)
Returns an allocated ColorResult that will move the cursor up a number of lines when printed...
Definition: colr.controls.c:313
ColorResult * Colr_scroll_up(unsigned int lines)
Returns an allocated ColorResult that will scroll the cursor up a number of lines when printed...
Definition: colr.controls.c:409
ColorResult * Colr_move_column(unsigned int column)
Returns an allocated ColorResult that will move the cursor to a specific column when printed...
Definition: colr.controls.c:182
ColorResult * Colr_scroll_down(unsigned int lines)
Returns an allocated ColorResult that will scroll the cursor down a number of lines when printed...
Definition: colr.controls.c:390
ColorResult * Colr_move_down(unsigned int lines)
Returns an allocated ColorResult that will move the cursor down a number of lines when printed...
Definition: colr.controls.c:201