diff --git a/include/notcurses.h b/include/notcurses.h index 479e69208..454aa6b37 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -628,6 +628,16 @@ notcurses_bg_prep(uint64_t* channels, int r, int g, int b){ return notcurses_channel_prep(channels, CELL_BG_MASK, 0, r, g, b, CELL_BGDEFAULT_MASK); } +static inline void +notcurses_fg_default_prep(uint64_t* channels){ + *channels &= ~(CELL_FGDEFAULT_MASK); +} + +static inline void +notcurses_bg_default_prep(uint64_t* channels){ + *channels &= ~(CELL_BGDEFAULT_MASK); +} + static inline void cell_set_fg(cell* c, unsigned r, unsigned g, unsigned b){ notcurses_fg_prep(&c->channels, r, g, b); @@ -661,7 +671,7 @@ cell_inherits_style(const cell* c){ // use the default color for the foreground static inline void cell_fg_default(cell* c){ - c->channels &= ~CELL_FGDEFAULT_MASK; + notcurses_fg_default_prep(&c->channels); } // is the cell using the terminal's default foreground color for its foreground? @@ -673,7 +683,7 @@ cell_fg_default_p(const cell* c){ // use the default color for the background static inline void cell_bg_default(cell* c){ - c->channels &= ~CELL_BGDEFAULT_MASK; + notcurses_bg_default_prep(&c->channels); } // is the cell using the terminal's default background color for its background? diff --git a/src/demo/unicodeblocks.c b/src/demo/unicodeblocks.c index f559d4286..f9eee32a7 100644 --- a/src/demo/unicodeblocks.c +++ b/src/demo/unicodeblocks.c @@ -109,9 +109,17 @@ int unicodeblocks_demo(struct notcurses* nc){ return -1; } ++xstart; + cell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER; + cell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER; + cell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER; + cells_rounded_box(n, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl); + cell_set_bg(&hl, 0, 0, 0); + cell_set_bg(&vl, 0, 0, 0); if(ncplane_rounded_box_sized(n, 0, 0, BLOCKSIZE / CHUNKSIZE + 2, (CHUNKSIZE * 2) + 2, 0)){ return -1; } + cell_release(n, &ul); cell_release(n, &ur); cell_release(n, &hl); + cell_release(n, &ll); cell_release(n, &lr); cell_release(n, &vl); for(chunk = 0 ; chunk < BLOCKSIZE / CHUNKSIZE ; ++chunk){ if(ncplane_cursor_move_yx(n, 4 + chunk, xstart)){ return -1;