s/CELL_STYLE/NCSTYLE/ throughout

pull/315/head
nick black 4 years ago committed by Nick Black
parent 8984422f1e
commit 54c57b3487

@ -301,7 +301,7 @@ notcurses_term_dim_yx(const struct notcurses* n, int* RESTRICT rows,
int notcurses_refresh(struct notcurses* n);
// Returns a 16-bit bitmask in the LSBs of supported curses-style attributes
// (CELL_STYLE_UNDERLINE, CELL_STYLE_BOLD, etc.) The attribute is only
// (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only
// indicated as supported if the terminal can support it together with color.
// For more information, see the "ncv" capability in terminfo(5).
unsigned notcurses_supported_styles(const struct notcurses* nc);
@ -1307,7 +1307,7 @@ typedef struct cell {
// (values 0--0x7f), or an offset into a per-ncplane attached pool of
// varying-length UTF-8 grapheme clusters. This pool may thus be up to 32MB.
uint32_t gcluster; // 4B -> 4B
// CELL_STYLE_* attributes (16 bits) + 8 foreground palette index bits + 8
// NCSTYLE_* attributes (16 bits) + 8 foreground palette index bits + 8
// background palette index bits. palette index bits are used only if the
// corresponding default color bit *is not* set, and the corresponding
// palette index bit *is* set.
@ -1403,42 +1403,42 @@ 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 CELL_STYLE_MASK 0xffff0000ul
#define CELL_STYLE_STANDOUT 0x00800000ul
#define CELL_STYLE_UNDERLINE 0x00400000ul
#define CELL_STYLE_REVERSE 0x00200000ul
#define CELL_STYLE_BLINK 0x00100000ul
#define CELL_STYLE_DIM 0x00080000ul
#define CELL_STYLE_BOLD 0x00040000ul
#define CELL_STYLE_INVIS 0x00020000ul
#define CELL_STYLE_PROTECT 0x00010000ul
#define CELL_STYLE_ITALIC 0x01000000ul
#define NCSTYLE_MASK 0xffff0000ul
#define NCSTYLE_STANDOUT 0x00800000ul
#define NCSTYLE_UNDERLINE 0x00400000ul
#define NCSTYLE_REVERSE 0x00200000ul
#define NCSTYLE_BLINK 0x00100000ul
#define NCSTYLE_DIM 0x00080000ul
#define NCSTYLE_BOLD 0x00040000ul
#define NCSTYLE_INVIS 0x00020000ul
#define NCSTYLE_PROTECT 0x00010000ul
#define NCSTYLE_ITALIC 0x01000000ul
// Set the specified style bits for the cell 'c', whether they're actively
// supported or not.
static inline void
cell_styles_set(cell* c, unsigned stylebits){
c->attrword = (c->attrword & ~CELL_STYLE_MASK) | ((stylebits & CELL_STYLE_MASK));
c->attrword = (c->attrword & ~NCSTYLE_MASK) | ((stylebits & NCSTYLE_MASK));
}
// Extract the style bits from the cell's attrword.
static inline unsigned
cell_styles(const cell* c){
return c->attrword & CELL_STYLE_MASK;
return c->attrword & NCSTYLE_MASK;
}
// Add the specified styles (in the LSBs) to the cell's existing spec, whether
// they're actively supported or not.
static inline void
cell_styles_on(cell* c, unsigned stylebits){
c->attrword |= (stylebits & CELL_STYLE_MASK;
c->attrword |= (stylebits & NCSTYLE_MASK;
}
// Remove the specified styles (in the LSBs) from the cell's existing spec.
static inline void
cell_styles_off(cell* c, unsigned stylebits){
c->attrword &= ~(stylebits & CELL_STYLE_MASK);
c->attrword &= ~(stylebits & NCSTYLE_MASK);
}
// does the cell contain an East Asian Wide codepoint?

@ -1,5 +1,5 @@
#ifndef __NCPP_CELL_STYLE_HH
#define __NCPP_CELL_STYLE_HH
#ifndef __NCPP_NCSTYLE_HH
#define __NCPP_NCSTYLE_HH
#include <cstdint>
@ -12,15 +12,15 @@ namespace ncpp
enum class CellStyle : uint32_t
{
None = 0,
Standout = CELL_STYLE_STANDOUT,
Underline = CELL_STYLE_UNDERLINE,
Reverse = CELL_STYLE_REVERSE,
Blink = CELL_STYLE_BLINK,
Dim = CELL_STYLE_DIM,
Bold = CELL_STYLE_BOLD,
Invis = CELL_STYLE_INVIS,
Protect = CELL_STYLE_PROTECT,
Italic = CELL_STYLE_ITALIC,
Standout = NCSTYLE_STANDOUT,
Underline = NCSTYLE_UNDERLINE,
Reverse = NCSTYLE_REVERSE,
Blink = NCSTYLE_BLINK,
Dim = NCSTYLE_DIM,
Bold = NCSTYLE_BOLD,
Invis = NCSTYLE_INVIS,
Protect = NCSTYLE_PROTECT,
Italic = NCSTYLE_ITALIC,
};
DECLARE_ENUM_FLAG_OPERATORS (CellStyle)

@ -110,7 +110,7 @@ typedef struct cell {
// (values 0--0x7f), or an offset into a per-ncplane attached pool of
// varying-length UTF-8 grapheme clusters. This pool may thus be up to 32MB.
uint32_t gcluster; // 4B -> 4B
// CELL_STYLE_* attributes (16 bits) + 8 foreground palette index bits + 8
// NCSTYLE_* attributes (16 bits) + 8 foreground palette index bits + 8
// background palette index bits. palette index bits are used only if the
// corresponding default color bit *is not* set, and the corresponding
// palette index bit *is* set.
@ -436,7 +436,7 @@ API struct ncplane* ncplane_aligned(struct ncplane* n, int rows, int cols,
API struct ncplane* ncplane_dup(struct ncplane* n, void* opaque);
// Returns a 16-bit bitmask of supported curses-style attributes
// (CELL_STYLE_UNDERLINE, CELL_STYLE_BOLD, etc.) The attribute is only
// (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only
// indicated as supported if the terminal can support it together with color.
// For more information, see the "ncv" capability in terminfo(5).
API unsigned notcurses_supported_styles(const struct notcurses* nc);
@ -1570,41 +1570,41 @@ 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 CELL_STYLE_MASK 0xffff0000ul
#define CELL_STYLE_STANDOUT 0x00800000ul
#define CELL_STYLE_UNDERLINE 0x00400000ul
#define CELL_STYLE_REVERSE 0x00200000ul
#define CELL_STYLE_BLINK 0x00100000ul
#define CELL_STYLE_DIM 0x00080000ul
#define CELL_STYLE_BOLD 0x00040000ul
#define CELL_STYLE_INVIS 0x00020000ul
#define CELL_STYLE_PROTECT 0x00010000ul
#define CELL_STYLE_ITALIC 0x01000000ul
#define NCSTYLE_MASK 0xffff0000ul
#define NCSTYLE_STANDOUT 0x00800000ul
#define NCSTYLE_UNDERLINE 0x00400000ul
#define NCSTYLE_REVERSE 0x00200000ul
#define NCSTYLE_BLINK 0x00100000ul
#define NCSTYLE_DIM 0x00080000ul
#define NCSTYLE_BOLD 0x00040000ul
#define NCSTYLE_INVIS 0x00020000ul
#define NCSTYLE_PROTECT 0x00010000ul
#define NCSTYLE_ITALIC 0x01000000ul
// Set the specified style bits for the cell 'c', whether they're actively
// supported or not.
static inline void
cell_styles_set(cell* c, unsigned stylebits){
c->attrword = (c->attrword & ~CELL_STYLE_MASK) | ((stylebits & CELL_STYLE_MASK));
c->attrword = (c->attrword & ~NCSTYLE_MASK) | ((stylebits & NCSTYLE_MASK));
}
// Extract the style bits from the cell's attrword.
static inline unsigned
cell_styles(const cell* c){
return c->attrword & CELL_STYLE_MASK;
return c->attrword & NCSTYLE_MASK;
}
// Add the specified styles (in the LSBs) to the cell's existing spec, whether
// they're actively supported or not.
static inline void
cell_styles_on(cell* c, unsigned stylebits){
c->attrword |= (stylebits & CELL_STYLE_MASK);
c->attrword |= (stylebits & NCSTYLE_MASK);
}
// Remove the specified styles (in the LSBs) from the cell's existing spec.
static inline void
cell_styles_off(cell* c, unsigned stylebits){
c->attrword &= ~(stylebits & CELL_STYLE_MASK);
c->attrword &= ~(stylebits & NCSTYLE_MASK);
}
// Use the default color for the foreground.

@ -34,7 +34,7 @@ int intro(struct notcurses* nc){
if(ncplane_cursor_move_yx(ncp, 0, 0)){
return -1;
}
if(cells_rounded_box(ncp, CELL_STYLE_BOLD, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
if(cells_rounded_box(ncp, NCSTYLE_BOLD, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
return -1;
}
cell_set_fg(&ul, 0xff0000);
@ -86,16 +86,16 @@ int intro(struct notcurses* nc){
if(ncplane_putstr_aligned(ncp, rows / 2 - 2, NCALIGN_CENTER, s1) != (int)strlen(s1)){
return -1;
}
ncplane_styles_on(ncp, CELL_STYLE_ITALIC | CELL_STYLE_BOLD);
ncplane_styles_on(ncp, NCSTYLE_ITALIC | NCSTYLE_BOLD);
if(ncplane_putstr_aligned(ncp, rows / 2, NCALIGN_CENTER, str) != (int)strlen(str)){
return -1;
}
ncplane_styles_off(ncp, CELL_STYLE_ITALIC);
ncplane_styles_off(ncp, NCSTYLE_ITALIC);
ncplane_set_fg_rgb(ncp, 0xff, 0xff, 0xff);
if(ncplane_printf_aligned(ncp, rows - 5, NCALIGN_CENTER, "notcurses %s. press 'q' to quit.", notcurses_version()) < 0){
return -1;
}
ncplane_styles_off(ncp, CELL_STYLE_BOLD);
ncplane_styles_off(ncp, NCSTYLE_BOLD);
const wchar_t wstr[] = L"▏▁ ▂ ▃ ▄ ▅ ▆ ▇ █ █ ▇ ▆ ▅ ▄ ▃ ▂ ▁▕";
if(ncplane_putwstr_aligned(ncp, rows / 2 - 5, NCALIGN_CENTER, wstr) < 0){
return -1;
@ -103,11 +103,11 @@ int intro(struct notcurses* nc){
if(rows < 45){
ncplane_set_fg_rgb(ncp, 0xc0, 0, 0x80);
ncplane_set_bg_rgb(ncp, 0x20, 0x20, 0x20);
ncplane_styles_on(ncp, CELL_STYLE_BLINK); // heh FIXME replace with pulse
ncplane_styles_on(ncp, NCSTYLE_BLINK); // heh FIXME replace with pulse
if(ncplane_putstr_aligned(ncp, 2, NCALIGN_CENTER, "demo runs best with at least 45 lines") < 0){
return -1;
}
ncplane_styles_off(ncp, CELL_STYLE_BLINK); // heh FIXME replace with pulse
ncplane_styles_off(ncp, NCSTYLE_BLINK); // heh FIXME replace with pulse
}
struct timespec now;
clock_gettime(CLOCK_MONOTONIC_RAW, &now);

@ -101,19 +101,19 @@ outro_message(struct notcurses* nc, int* rows, int* cols){
if(ncplane_set_bg_alpha(non, CELL_ALPHA_OPAQUE)){ // FIXME use intermediate
return NULL;
}
ncplane_styles_on(non, CELL_STYLE_BOLD);
ncplane_styles_on(non, NCSTYLE_BOLD);
if(ncplane_putstr_aligned(non, ++ybase, NCALIGN_CENTER, str0) < 0){
return NULL;
}
ncplane_styles_off(non, CELL_STYLE_BOLD);
ncplane_styles_off(non, NCSTYLE_BOLD);
if(ncplane_putstr_aligned(non, ++ybase, NCALIGN_CENTER, str1) < 0){
return NULL;
}
ncplane_styles_on(non, CELL_STYLE_ITALIC);
ncplane_styles_on(non, NCSTYLE_ITALIC);
if(ncplane_putstr_aligned(non, ++ybase, NCALIGN_CENTER, str2) < 0){
return NULL;
}
ncplane_styles_off(non, CELL_STYLE_ITALIC);
ncplane_styles_off(non, NCSTYLE_ITALIC);
if(demo_render(nc)){
return NULL;
}

@ -143,14 +143,14 @@ tabletdraw(struct tablet* t, int begx, int begy, int maxx, int maxy, bool clipto
summaryy = ll;
}
}
ncplane_styles_on(p, CELL_STYLE_BOLD);
ncplane_styles_on(p, NCSTYLE_BOLD);
if(ncplane_printf_yx(p, summaryy, begx, "[#%u %d line%s %u/%u] ",
tctx->id, tctx->lines, tctx->lines == 1 ? "" : "s",
begy, maxy) < 0){
pthread_mutex_unlock(&tctx->lock);
return -1;
}
ncplane_styles_off(p, CELL_STYLE_BOLD);
ncplane_styles_off(p, NCSTYLE_BOLD);
}
/*fprintf(stderr, " \\--> callback for %d, %d lines (%d/%d -> %d/%d) dir: %s wrote: %d ret: %d\n", tctx->id,
tctx->lines, begy, begx, maxy, maxx,
@ -302,11 +302,11 @@ panelreel_demo_core(struct notcurses* nc, int efdr, int efdw){
}
// Press a for a new panel above the current, c for a new one below the
// current, and b for a new block at arbitrary placement.
ncplane_styles_on(w, CELL_STYLE_BOLD | CELL_STYLE_ITALIC);
ncplane_styles_on(w, NCSTYLE_BOLD | NCSTYLE_ITALIC);
ncplane_set_fg_rgb(w, 58, 150, 221);
ncplane_set_bg_default(w);
ncplane_printf_yx(w, 1, 1, "a, b, c create tablets, DEL deletes.");
ncplane_styles_off(w, CELL_STYLE_BOLD | CELL_STYLE_ITALIC);
ncplane_styles_off(w, NCSTYLE_BOLD | NCSTYLE_ITALIC);
// FIXME clrtoeol();
struct timespec deadline;
clock_gettime(CLOCK_MONOTONIC, &deadline);
@ -329,9 +329,9 @@ panelreel_demo_core(struct notcurses* nc, int efdr, int efdw){
ncplane_styles_set(w, 0);
ncplane_set_fg_rgb(w, 197, 15, 31);
int count = panelreel_tabletcount(pr);
ncplane_styles_on(w, CELL_STYLE_BOLD);
ncplane_styles_on(w, NCSTYLE_BOLD);
ncplane_printf_yx(w, 2, 2, "%d tablet%s", count, count == 1 ? "" : "s");
ncplane_styles_off(w, CELL_STYLE_BOLD);
ncplane_styles_off(w, NCSTYLE_BOLD);
// FIXME wclrtoeol(w);
ncplane_set_fg_rgb(w, 0, 55, 218);
wchar_t rw;

@ -41,7 +41,7 @@ legend(struct notcurses* nc, int dimy, int dimx){
uint64_t channels = 0;
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
ncplane_set_base(n, channels, 0, " ");
ncplane_styles_set(n, CELL_STYLE_BOLD);
ncplane_styles_set(n, NCSTYLE_BOLD);
ncplane_set_fg_rgb(n, 0xff, 0xff, 0xff);
if(ncplane_putstr_aligned(n, 0, NCALIGN_CENTER, "target launch") <= 0){
ncplane_destroy(n);
@ -61,7 +61,7 @@ legend(struct notcurses* nc, int dimy, int dimx){
ncplane_destroy(n);
return NULL;
}
ncplane_styles_off(n, CELL_STYLE_BOLD);
ncplane_styles_off(n, NCSTYLE_BOLD);
return n;
}

@ -199,10 +199,10 @@ message(struct ncplane* n, int maxy, int maxx, int num, int total,
ncplane_putegc_yx(n, 2, 19, "", NULL);
ncplane_set_fg_rgb(n, 64, 128, 240);
ncplane_set_bg_rgb(n, 32, 64, 32);
ncplane_styles_on(n, CELL_STYLE_ITALIC);
ncplane_styles_on(n, NCSTYLE_ITALIC);
ncplane_printf_yx(n, 5, 18, " bytes: %05d EGCs: %05d cols: %05d ", bytes_out, egs_out, cols_out);
ncplane_printf_yx(n, 1, 4, " %03dx%03d (%d/%d) ", maxx, maxy, num + 1, total);
ncplane_styles_off(n, CELL_STYLE_ITALIC);
ncplane_styles_off(n, NCSTYLE_ITALIC);
ncplane_set_fg_rgb(n, 224, 128, 224);
ncplane_putstr_yx(n, 3, 1, " 🔥 unicode 13, resize awareness, 24b directcolor…🔥 ");
ncplane_set_fg_rgb(n, 255, 255, 255);

@ -1382,13 +1382,13 @@ int ncplane_putstr_yx(ncplane* n, int y, int x, const char* gclusters){
unsigned notcurses_supported_styles(const notcurses* nc){
unsigned styles = 0;
styles |= nc->standout ? CELL_STYLE_STANDOUT : 0;
styles |= nc->uline ? CELL_STYLE_UNDERLINE : 0;
styles |= nc->reverse ? CELL_STYLE_REVERSE : 0;
styles |= nc->blink ? CELL_STYLE_BLINK : 0;
styles |= nc->dim ? CELL_STYLE_DIM : 0;
styles |= nc->bold ? CELL_STYLE_BOLD : 0;
styles |= nc->italics ? CELL_STYLE_ITALIC : 0;
styles |= nc->standout ? NCSTYLE_STANDOUT : 0;
styles |= nc->uline ? NCSTYLE_UNDERLINE : 0;
styles |= nc->reverse ? NCSTYLE_REVERSE : 0;
styles |= nc->blink ? NCSTYLE_BLINK : 0;
styles |= nc->dim ? NCSTYLE_DIM : 0;
styles |= nc->bold ? NCSTYLE_BOLD : 0;
styles |= nc->italics ? NCSTYLE_ITALIC : 0;
return styles;
}
@ -1399,28 +1399,28 @@ int notcurses_palette_size(const notcurses* nc){
// turn on any specified stylebits
void ncplane_styles_on(ncplane* n, unsigned stylebits){
ncplane_lock(n);
n->attrword |= (stylebits & CELL_STYLE_MASK);
n->attrword |= (stylebits & NCSTYLE_MASK);
ncplane_unlock(n);
}
// turn off any specified stylebits
void ncplane_styles_off(ncplane* n, unsigned stylebits){
ncplane_lock(n);
n->attrword &= ~(stylebits & CELL_STYLE_MASK);
n->attrword &= ~(stylebits & NCSTYLE_MASK);
ncplane_unlock(n);
}
// set the current stylebits to exactly those provided
void ncplane_styles_set(ncplane* n, unsigned stylebits){
ncplane_lock(n);
n->attrword = (n->attrword & ~CELL_STYLE_MASK) | ((stylebits & CELL_STYLE_MASK));
n->attrword = (n->attrword & ~NCSTYLE_MASK) | ((stylebits & NCSTYLE_MASK));
ncplane_unlock(n);
}
unsigned ncplane_styles(ncplane* n){
unsigned ret;
ncplane_lock(n);
ret = (n->attrword & CELL_STYLE_MASK);
ret = (n->attrword & NCSTYLE_MASK);
ncplane_unlock(n);
return ret;
}

@ -461,24 +461,24 @@ term_setstyles(const notcurses* nc, FILE* out, uint32_t* curattr, const cell* c,
if((cellattr ^ *curattr) & 0x00ff0000ul){
*normalized = true; // FIXME this is pretty conservative
// if everything's 0, emit the shorter sgr0
if(nc->sgr0 && ((cellattr & CELL_STYLE_MASK) == 0)){
if(nc->sgr0 && ((cellattr & NCSTYLE_MASK) == 0)){
if(term_emit("sgr0", nc->sgr0, out, false) < 0){
ret = -1;
}
}else if(term_emit("sgr", tiparm(nc->sgr, cellattr & CELL_STYLE_STANDOUT,
cellattr & CELL_STYLE_UNDERLINE,
cellattr & CELL_STYLE_REVERSE,
cellattr & CELL_STYLE_BLINK,
cellattr & CELL_STYLE_DIM,
cellattr & CELL_STYLE_BOLD,
cellattr & CELL_STYLE_INVIS,
cellattr & CELL_STYLE_PROTECT, 0),
}else if(term_emit("sgr", tiparm(nc->sgr, cellattr & NCSTYLE_STANDOUT,
cellattr & NCSTYLE_UNDERLINE,
cellattr & NCSTYLE_REVERSE,
cellattr & NCSTYLE_BLINK,
cellattr & NCSTYLE_DIM,
cellattr & NCSTYLE_BOLD,
cellattr & NCSTYLE_INVIS,
cellattr & NCSTYLE_PROTECT, 0),
out, false) < 0){
ret = -1;
}
}
// sgr will blow away italics if they were set beforehand
ret |= term_setstyle(out, *curattr, cellattr, CELL_STYLE_ITALIC, nc->italics, nc->italoff);
ret |= term_setstyle(out, *curattr, cellattr, NCSTYLE_ITALIC, nc->italics, nc->italoff);
*curattr = cellattr;
return ret;
}

@ -23,6 +23,14 @@ int main(void){
notcurses_render(nc);
char32_t keypress;
ncinput ni;
int dimy, dimx;
struct ncplane* n = notcurses_stdplane(nc);
ncplane_dim_yx(n, &dimy, &dimx);
ncplane_styles_on(n, NCSTYLE_REVERSE);
if(ncplane_putstr_aligned(n, dimy - 1, NCALIGN_RIGHT, "menu poc. press q to exit") < 0){
return EXIT_FAILURE;
}
notcurses_render(nc);
while((keypress = notcurses_getc_blocking(nc, &ni)) != (char32_t)-1){
switch(keypress){
// FIXME

@ -40,39 +40,39 @@ SUBCASE("SetItalic") {
cell c = CELL_TRIVIAL_INITIALIZER;
int dimy, dimx;
notcurses_term_dim_yx(nc_, &dimy, &dimx);
cell_styles_set(&c, CELL_STYLE_ITALIC);
cell_styles_set(&c, NCSTYLE_ITALIC);
REQUIRE(1 == cell_load(n_, &c, "i"));
cell_set_fg_rgb(&c, 255, 255, 255);
ncplane_set_base_cell(n_, &c);
cell_release(n_, &c);
CHECK(0 == notcurses_render(nc_));
cell_styles_off(&c, CELL_STYLE_ITALIC);
cell_styles_off(&c, NCSTYLE_ITALIC);
}
SUBCASE("SetBold") {
cell c = CELL_TRIVIAL_INITIALIZER;
int dimy, dimx;
notcurses_term_dim_yx(nc_, &dimy, &dimx);
cell_styles_set(&c, CELL_STYLE_BOLD);
cell_styles_set(&c, NCSTYLE_BOLD);
REQUIRE(1 == cell_load(n_, &c, "b"));
cell_set_fg_rgb(&c, 255, 255, 255);
ncplane_set_base_cell(n_, &c);
cell_release(n_, &c);
CHECK(0 == notcurses_render(nc_));
cell_styles_off(&c, CELL_STYLE_BOLD);
cell_styles_off(&c, NCSTYLE_BOLD);
}
SUBCASE("SetUnderline") {
cell c = CELL_TRIVIAL_INITIALIZER;
int dimy, dimx;
notcurses_term_dim_yx(nc_, &dimy, &dimx);
cell_styles_set(&c, CELL_STYLE_UNDERLINE);
cell_styles_set(&c, NCSTYLE_UNDERLINE);
REQUIRE(1 == cell_load(n_, &c, "u"));
cell_set_fg_rgb(&c, 255, 255, 255);
ncplane_set_base_cell(n_, &c);
cell_release(n_, &c);
CHECK(0 == notcurses_render(nc_));
cell_styles_off(&c, CELL_STYLE_UNDERLINE);
cell_styles_off(&c, NCSTYLE_UNDERLINE);
}
/* SUBCASE("CellLoadTamil") {

@ -628,17 +628,17 @@ TEST_CASE("NCPlane") {
const char STR1[] = "this has been a world destroyer production";
const char STR2[] = "not to mention dank";
const char STR3[] = "da chronic lives";
ncplane_styles_set(n_, CELL_STYLE_BOLD);
ncplane_styles_set(n_, NCSTYLE_BOLD);
REQUIRE(0 < ncplane_putstr(n_, STR1));
int y, x;
ncplane_cursor_yx(n_, &y, &x);
CHECK(0 == ncplane_cursor_move_yx(n_, y + 1, x - strlen(STR2)));
ncplane_styles_on(n_, CELL_STYLE_ITALIC);
ncplane_styles_on(n_, NCSTYLE_ITALIC);
REQUIRE(0 < ncplane_putstr(n_, STR2));
CHECK(0 == ncplane_cursor_move_yx(n_, y + 2, x - strlen(STR3)));
ncplane_styles_off(n_, CELL_STYLE_BOLD);
ncplane_styles_off(n_, NCSTYLE_BOLD);
REQUIRE(0 < ncplane_putstr(n_, STR3));
ncplane_styles_off(n_, CELL_STYLE_ITALIC);
ncplane_styles_off(n_, NCSTYLE_ITALIC);
CHECK(0 == notcurses_render(nc_));
int newx;
ncplane_cursor_yx(n_, &y, &newx);

@ -49,10 +49,10 @@ TEST_CASE("NotcursesBase") {
CHECK(newy == y);
}
// we should at least have CELL_STYLE_BOLD everywhere, i should think?
// we should at least have NCSTYLE_BOLD everywhere, i should think?
SUBCASE("CursesStyles") {
unsigned attrs = notcurses_supported_styles(nc_);
CHECK(1 == !!(CELL_STYLE_BOLD & attrs));
CHECK(1 == !!(NCSTYLE_BOLD & attrs));
}
// it is an error to attempt to destroy the standard plane

Loading…
Cancel
Save