diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ad00cef..6cf0a2765 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,6 +538,14 @@ add_test( NAME ncpp_build_exceptions COMMAND ncpp_build_exceptions ) +add_test( + NAME sgr-full + COMMAND sgr-full +) +add_test( + NAME sgr-direct + COMMAND sgr-direct +) add_test( NAME rgb COMMAND rgb diff --git a/USAGE.md b/USAGE.md index 92d113514..2054939cc 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1696,7 +1696,7 @@ int cell_duplicate(struct ncplane* n, cell* targ, const cell* c); // Release resources held by the cell 'c'. void cell_release(struct ncplane* n, cell* c); -#define NCSTYLE_MASK 0xfffful +#define NCSTYLE_MASK 0x03fful #define NCSTYLE_STANDOUT 0x0080ul #define NCSTYLE_UNDERLINE 0x0040ul #define NCSTYLE_REVERSE 0x0020ul diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 62201f452..902d83156 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -605,7 +605,7 @@ API int cell_duplicate(struct ncplane* n, cell* targ, const cell* c); // Release resources held by the cell 'c'. API void cell_release(struct ncplane* n, cell* c); -#define NCSTYLE_MASK 0xffffu +#define NCSTYLE_MASK 0x03ffu #define NCSTYLE_STANDOUT 0x0080u #define NCSTYLE_UNDERLINE 0x0040u #define NCSTYLE_REVERSE 0x0020u diff --git a/src/poc/sgr-full.c b/src/poc/sgr-full.c index e32321a00..a89b08717 100644 --- a/src/poc/sgr-full.c +++ b/src/poc/sgr-full.c @@ -3,13 +3,17 @@ #include int main(void){ - struct notcurses* nc = notcurses_init(NULL, NULL); + struct notcurses_options nopts = { + .flags = NCOPTION_NO_ALTERNATE_SCREEN, + }; + struct notcurses* nc = notcurses_init(&nopts, NULL); if(nc == NULL){ return EXIT_FAILURE; } int dimy, dimx; struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx); int y = 0; + // FIXME do full permutations? ncplane_set_styles(n, NCSTYLE_NONE); ncplane_putstr_yx(n, y++, 0, "a ═ none"); ncplane_set_styles(n, NCSTYLE_ITALIC); @@ -23,7 +27,7 @@ int main(void){ ncplane_set_styles(n, NCSTYLE_BLINK); ncplane_putstr_yx(n, y++, 0, "a ═ blink"); ncplane_set_styles(n, NCSTYLE_STRUCK); - ncplane_putstr_yx(n, y++, 0, "a ═ strikethrough"); + ncplane_putstr_yx(n, y++, 0, "a ═ struck"); ncplane_set_styles(n, NCSTYLE_ITALIC | NCSTYLE_BOLD); ncplane_putstr_yx(n, y++, 0, "a ═ italic bold"); ncplane_set_styles(n, NCSTYLE_ITALIC | NCSTYLE_REVERSE); @@ -48,11 +52,14 @@ int main(void){ ncplane_putstr_yx(n, y++, 0, "a ═ bold underline"); ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_BLINK); ncplane_putstr_yx(n, y++, 0, "a ═ bold blink"); - ncplane_putstr_yx(n, y++, 0, "sleeping for 15s..."); + ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_REVERSE | NCSTYLE_UNDERLINE | + NCSTYLE_BLINK | NCSTYLE_ITALIC | NCSTYLE_STRUCK); + ncplane_putstr_yx(n, y++, 0, "a ═ whoomp! there it is"); + + ncplane_set_styles(n, NCSTYLE_NONE); if(notcurses_render(nc)){ goto err; } - sleep(15); if(notcurses_stop(nc)){ return EXIT_FAILURE; }