mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
normalize cell initializer names (prefix with NC)
This commit is contained in:
parent
b340f01a0a
commit
7a91a2f905
2
NEWS.md
2
NEWS.md
@ -32,6 +32,8 @@ rearrangements of Notcurses.
|
|||||||
* `ncplayer` now defaults to pixel blitting.
|
* `ncplayer` now defaults to pixel blitting.
|
||||||
* `NCKEY_SIGNAL` is no longer a synonym for `NCKEY_RESIZE`, but instead
|
* `NCKEY_SIGNAL` is no longer a synonym for `NCKEY_RESIZE`, but instead
|
||||||
indicates receipt of `SIGCONT`.
|
indicates receipt of `SIGCONT`.
|
||||||
|
* `CELL_TRIVIAL_INITIALIZER`, `CELL_CHAR_INITIALIZER`, and
|
||||||
|
`CELL_INITIALIZER` are all now prefixed with `NC`.
|
||||||
* A new resize callback, `ncplane_resize_placewithin()`, has been added.
|
* A new resize callback, `ncplane_resize_placewithin()`, has been added.
|
||||||
|
|
||||||
* 2.4.9 (2021-11-11)
|
* 2.4.9 (2021-11-11)
|
||||||
|
@ -30,13 +30,13 @@ namespace ncpp
|
|||||||
explicit Cell (uint32_t c, NotCurses *ncinst = nullptr) noexcept
|
explicit Cell (uint32_t c, NotCurses *ncinst = nullptr) noexcept
|
||||||
: Root (ncinst)
|
: Root (ncinst)
|
||||||
{
|
{
|
||||||
_cell = CELL_CHAR_INITIALIZER (c);
|
_cell = NCCELL_CHAR_INITIALIZER (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Cell (uint32_t c, uint16_t a, uint64_t chan, NotCurses *ncinst = nullptr) noexcept
|
explicit Cell (uint32_t c, uint16_t a, uint64_t chan, NotCurses *ncinst = nullptr) noexcept
|
||||||
: Root (ncinst)
|
: Root (ncinst)
|
||||||
{
|
{
|
||||||
_cell = CELL_INITIALIZER (c, a, chan);
|
_cell = NCCELL_INITIALIZER (c, a, chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator nccell* () noexcept
|
operator nccell* () noexcept
|
||||||
|
@ -652,14 +652,14 @@ typedef struct nccell {
|
|||||||
// protect against such misuse here. problems *will* ensue. similarly, do not
|
// protect against such misuse here. problems *will* ensue. similarly, do not
|
||||||
// set channel flags other than colors/alpha. we assign non-printing glyphs
|
// set channel flags other than colors/alpha. we assign non-printing glyphs
|
||||||
// a width of 1 to match utf8_egc_len()'s behavior for whitespace/NUL.
|
// a width of 1 to match utf8_egc_len()'s behavior for whitespace/NUL.
|
||||||
#define CELL_INITIALIZER(c, s, chan) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
|
#define NCCELL_INITIALIZER(c, s, chan) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
|
||||||
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = (s), .channels = (chan), }
|
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = (s), .channels = (chan), }
|
||||||
// python fails on #define CELL_CHAR_INITIALIZER(c) CELL_INITIALIZER(c, 0, 0)
|
// python fails on #define CELL_CHAR_INITIALIZER(c) CELL_INITIALIZER(c, 0, 0)
|
||||||
#define CELL_CHAR_INITIALIZER(c) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
|
#define NCCELL_CHAR_INITIALIZER(c) { .gcluster = (htole(c)), .gcluster_backstop = 0,\
|
||||||
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = 0, .channels = 0, }
|
.width = (uint8_t)((wcwidth(c) < 0 || !c) ? 1 : wcwidth(c)), .stylemask = 0, .channels = 0, }
|
||||||
// python fails on #define CELL_TRIVIAL_INITIALIZER CELL_CHAR_INITIALIZER(0)
|
// python fails on #define CELL_TRIVIAL_INITIALIZER CELL_CHAR_INITIALIZER(0)
|
||||||
#define CELL_TRIVIAL_INITIALIZER { .gcluster = 0, .gcluster_backstop = 0,\
|
#define NCCELL_TRIVIAL_INITIALIZER { .gcluster = 0, .gcluster_backstop = 0,\
|
||||||
.width = 1, .stylemask = 0, .channels = 0, }
|
.width = 1, .stylemask = 0, .channels = 0, }
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
nccell_init(nccell* c){
|
nccell_init(nccell* c){
|
||||||
@ -1929,7 +1929,7 @@ ncplane_putc(struct ncplane* n, const nccell* c){
|
|||||||
// This works whether the underlying char is signed or unsigned.
|
// This works whether the underlying char is signed or unsigned.
|
||||||
static inline int
|
static inline int
|
||||||
ncplane_putchar_yx(struct ncplane* n, int y, int x, char c){
|
ncplane_putchar_yx(struct ncplane* n, int y, int x, char c){
|
||||||
nccell ce = CELL_INITIALIZER((uint32_t)c, ncplane_styles(n), ncplane_channels(n));
|
nccell ce = NCCELL_INITIALIZER((uint32_t)c, ncplane_styles(n), ncplane_channels(n));
|
||||||
return ncplane_putc_yx(n, y, x, &ce);
|
return ncplane_putc_yx(n, y, x, &ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2889,9 +2889,9 @@ static inline int
|
|||||||
ncplane_rounded_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
ncplane_rounded_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||||
unsigned ystop, unsigned xstop, unsigned ctlword){
|
unsigned ystop, unsigned xstop, unsigned ctlword){
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if((ret = nccells_rounded_box(n, styles, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){
|
if((ret = nccells_rounded_box(n, styles, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){
|
||||||
ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword);
|
ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ystop, xstop, ctlword);
|
||||||
}
|
}
|
||||||
@ -2909,12 +2909,12 @@ ncplane_perimeter_rounded(struct ncplane* n, uint16_t stylemask,
|
|||||||
}
|
}
|
||||||
unsigned dimy, dimx;
|
unsigned dimy, dimx;
|
||||||
ncplane_dim_yx(n, &dimy, &dimx);
|
ncplane_dim_yx(n, &dimy, &dimx);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell lr = CELL_TRIVIAL_INITIALIZER;
|
nccell lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell vl = CELL_TRIVIAL_INITIALIZER;
|
nccell vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccells_rounded_box(n, stylemask, channels, &ul, &ur, &ll, &lr, &hl, &vl)){
|
if(nccells_rounded_box(n, stylemask, channels, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2938,9 +2938,9 @@ static inline int
|
|||||||
ncplane_double_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
ncplane_double_box(struct ncplane* n, uint16_t styles, uint64_t channels,
|
||||||
unsigned ylen, unsigned xlen, unsigned ctlword){
|
unsigned ylen, unsigned xlen, unsigned ctlword){
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if((ret = nccells_double_box(n, styles, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){
|
if((ret = nccells_double_box(n, styles, channels, &ul, &ur, &ll, &lr, &hl, &vl)) == 0){
|
||||||
ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ylen, xlen, ctlword);
|
ret = ncplane_box(n, &ul, &ur, &ll, &lr, &hl, &vl, ylen, xlen, ctlword);
|
||||||
}
|
}
|
||||||
@ -2958,12 +2958,12 @@ ncplane_perimeter_double(struct ncplane* n, uint16_t stylemask,
|
|||||||
}
|
}
|
||||||
unsigned dimy, dimx;
|
unsigned dimy, dimx;
|
||||||
ncplane_dim_yx(n, &dimy, &dimx);
|
ncplane_dim_yx(n, &dimy, &dimx);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell lr = CELL_TRIVIAL_INITIALIZER;
|
nccell lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell vl = CELL_TRIVIAL_INITIALIZER;
|
nccell vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccells_double_box(n, stylemask, channels, &ul, &ur, &ll, &lr, &hl, &vl)){
|
if(nccells_double_box(n, stylemask, channels, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,9 @@ int box_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
ncchannels_set_bg_alpha(&transchan, NCALPHA_TRANSPARENT);
|
ncchannels_set_bg_alpha(&transchan, NCALPHA_TRANSPARENT);
|
||||||
ncchannels_set_fg_alpha(&transchan, NCALPHA_TRANSPARENT);
|
ncchannels_set_fg_alpha(&transchan, NCALPHA_TRANSPARENT);
|
||||||
ncplane_set_base(n, "", 0, transchan);
|
ncplane_set_base(n, "", 0, transchan);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ll = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ll = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell lr = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell lr = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccells_double_box(n, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
if(nccells_double_box(n, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ int chunli_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned dimx, dimy;
|
unsigned dimx, dimy;
|
||||||
ncplane_dim_yx(notcurses_stdplane_const(nc), &dimy, &dimx);
|
ncplane_dim_yx(notcurses_stdplane_const(nc), &dimy, &dimx);
|
||||||
nccell b = CELL_TRIVIAL_INITIALIZER;
|
nccell b = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&b, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&b, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&b, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&b, NCALPHA_TRANSPARENT);
|
||||||
if( (ret = chunli_draw(nc, "bmp", CHUNS, &b)) ){
|
if( (ret = chunli_draw(nc, "bmp", CHUNS, &b)) ){
|
||||||
|
@ -119,7 +119,7 @@ zoom_map(struct notcurses* nc, const char* map, int* ret){
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
draw_eagle(struct ncplane* n, const char* sprite){
|
draw_eagle(struct ncplane* n, const char* sprite){
|
||||||
nccell bgc = CELL_TRIVIAL_INITIALIZER;
|
nccell bgc = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&bgc, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&bgc, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&bgc, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&bgc, NCALPHA_TRANSPARENT);
|
||||||
ncplane_set_base_cell(n, &bgc);
|
ncplane_set_base_cell(n, &bgc);
|
||||||
|
@ -161,7 +161,7 @@ int fission_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
ncplane_resize_simple(n, newy, newx);
|
ncplane_resize_simple(n, newy, newx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
uint16_t smask;
|
uint16_t smask;
|
||||||
uint64_t channels;
|
uint64_t channels;
|
||||||
char* egc = ncplane_at_yx(stdn, usey, usex, &smask, &channels);
|
char* egc = ncplane_at_yx(stdn, usey, usex, &smask, &channels);
|
||||||
|
@ -75,7 +75,7 @@ int highcon_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
const char motto[] = " high contrast text is evaluated relative to the solved background";
|
const char motto[] = " high contrast text is evaluated relative to the solved background";
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
unsigned total = 0, r = 0, g = 0, b = 0;
|
unsigned total = 0, r = 0, g = 0, b = 0;
|
||||||
for(int out = 0 ; out < totcells ; ++out){ // build up the initial screen
|
for(int out = 0 ; out < totcells ; ++out){ // build up the initial screen
|
||||||
scrcolors[out] = generate_next_color(&total, &r, &g, &b, STEP);
|
scrcolors[out] = generate_next_color(&total, &r, &g, &b, STEP);
|
||||||
|
@ -124,7 +124,7 @@ debug_toggle(struct notcurses* nc){
|
|||||||
}
|
}
|
||||||
fbuf_free(&f);
|
fbuf_free(&f);
|
||||||
for(unsigned y = 0 ; y < ncplane_dim_y(n) ; ++y){
|
for(unsigned y = 0 ; y < ncplane_dim_y(n) ; ++y){
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
ncplane_putc_yx(n, y, ncplane_dim_x(n) - 1, &c);
|
ncplane_putc_yx(n, y, ncplane_dim_x(n) - 1, &c);
|
||||||
@ -171,9 +171,9 @@ about_toggle(struct notcurses* nc){
|
|||||||
ncplane_printf_aligned(n, 4, NCALIGN_RIGHT, "restart Ctrl+R ");
|
ncplane_printf_aligned(n, 4, NCALIGN_RIGHT, "restart Ctrl+R ");
|
||||||
ncplane_printf_aligned(n, 5, NCALIGN_CENTER, "q quit");
|
ncplane_printf_aligned(n, 5, NCALIGN_CENTER, "q quit");
|
||||||
ncplane_putstr_aligned(n, 7, NCALIGN_CENTER, "\u00a9 nick black <nickblack@linux.com>");
|
ncplane_putstr_aligned(n, 7, NCALIGN_CENTER, "\u00a9 nick black <nickblack@linux.com>");
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell lr = CELL_TRIVIAL_INITIALIZER, ll = CELL_TRIVIAL_INITIALIZER;
|
nccell lr = NCCELL_TRIVIAL_INITIALIZER, ll = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
channels = 0;
|
channels = 0;
|
||||||
ncchannels_set_fg_rgb(&channels, 0xc020c0);
|
ncchannels_set_fg_rgb(&channels, 0xc020c0);
|
||||||
ncchannels_set_bg_rgb(&channels, 0);
|
ncchannels_set_bg_rgb(&channels, 0);
|
||||||
@ -337,9 +337,9 @@ struct ncmenu* menu_create(struct notcurses* nc){
|
|||||||
static int
|
static int
|
||||||
hud_refresh(struct ncplane* n){
|
hud_refresh(struct ncplane* n){
|
||||||
ncplane_erase(n);
|
ncplane_erase(n);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell lr = CELL_TRIVIAL_INITIALIZER, ll = CELL_TRIVIAL_INITIALIZER;
|
nccell lr = NCCELL_TRIVIAL_INITIALIZER, ll = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccells_rounded_box(n, NCSTYLE_NONE, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
if(nccells_rounded_box(n, NCSTYLE_NONE, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ hud_print_finished(elem* list){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(hud){
|
if(hud){
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_base(hud, &c);
|
ncplane_base(hud, &c);
|
||||||
ncplane_set_bg_rgb(hud, nccell_bg_rgb(&c));
|
ncplane_set_bg_rgb(hud, nccell_bg_rgb(&c));
|
||||||
ncplane_set_bg_alpha(hud, NCALPHA_BLEND);
|
ncplane_set_bg_alpha(hud, NCALPHA_BLEND);
|
||||||
@ -395,7 +395,7 @@ hud_print_finished(elem* list){
|
|||||||
char buf[NCPREFIXCOLUMNS + 2];
|
char buf[NCPREFIXCOLUMNS + 2];
|
||||||
ncnmetric(e->totalns, sizeof(buf), NANOSECS_IN_SEC, buf, 0, 1000, '\0');
|
ncnmetric(e->totalns, sizeof(buf), NANOSECS_IN_SEC, buf, 0, 1000, '\0');
|
||||||
for(int x = 6 ; x < 14 - ncstrwidth(buf, NULL, NULL) ; ++x){
|
for(int x = 6 ; x < 14 - ncstrwidth(buf, NULL, NULL) ; ++x){
|
||||||
nccell ci = CELL_TRIVIAL_INITIALIZER;
|
nccell ci = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_putc_yx(hud, 1, x, &ci);
|
ncplane_putc_yx(hud, 1, x, &ci);
|
||||||
}
|
}
|
||||||
if(ncplane_printf_yx(hud, line, 14 - ncstrwidth(buf, NULL, NULL), "%ss", buf) < 0){
|
if(ncplane_printf_yx(hud, line, 14 - ncstrwidth(buf, NULL, NULL), "%ss", buf) < 0){
|
||||||
@ -599,7 +599,7 @@ int demo_render(struct notcurses* nc){
|
|||||||
}
|
}
|
||||||
uint64_t ns = timespec_to_ns(&ts) - elems->startns;
|
uint64_t ns = timespec_to_ns(&ts) - elems->startns;
|
||||||
++elems->frames;
|
++elems->frames;
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_base(hud, &c);
|
ncplane_base(hud, &c);
|
||||||
ncplane_set_bg_rgb(hud, nccell_bg_rgb(&c));
|
ncplane_set_bg_rgb(hud, nccell_bg_rgb(&c));
|
||||||
ncplane_set_bg_alpha(hud, NCALPHA_BLEND);
|
ncplane_set_bg_alpha(hud, NCALPHA_BLEND);
|
||||||
@ -613,7 +613,7 @@ int demo_render(struct notcurses* nc){
|
|||||||
char buf[NCPREFIXCOLUMNS + 2];
|
char buf[NCPREFIXCOLUMNS + 2];
|
||||||
ncnmetric(ns, sizeof(buf), NANOSECS_IN_SEC, buf, 0, 1000, '\0');
|
ncnmetric(ns, sizeof(buf), NANOSECS_IN_SEC, buf, 0, 1000, '\0');
|
||||||
for(int x = 6 ; x < 14 - ncstrwidth(buf, NULL, NULL) ; ++x){
|
for(int x = 6 ; x < 14 - ncstrwidth(buf, NULL, NULL) ; ++x){
|
||||||
nccell ci = CELL_TRIVIAL_INITIALIZER;
|
nccell ci = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_putc_yx(hud, 1, x, &ci);
|
ncplane_putc_yx(hud, 1, x, &ci);
|
||||||
}
|
}
|
||||||
//fprintf(stderr, "[%s] %zu %d\n", buf, strlen(buf), ncstrwidth(buf, NULL, NULL));
|
//fprintf(stderr, "[%s] %zu %d\n", buf, strlen(buf), ncstrwidth(buf, NULL, NULL));
|
||||||
|
@ -104,12 +104,12 @@ int intro_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
if(ncplane_gradient2x1(ncp, -1, -1, rows - 3, cols - 2, ccul, ccur, ccll, cclr) <= 0){
|
if(ncplane_gradient2x1(ncp, -1, -1, rows - 3, cols - 2, ccul, ccur, ccll, cclr) <= 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_bg_rgb8(&c, 0x20, 0x20, 0x20);
|
nccell_set_bg_rgb8(&c, 0x20, 0x20, 0x20);
|
||||||
ncplane_set_base_cell(ncp, &c);
|
ncplane_set_base_cell(ncp, &c);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(ncplane_cursor_move_yx(ncp, 1, 0)){
|
if(ncplane_cursor_move_yx(ncp, 1, 0)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -26609,7 +26609,7 @@ int jungle_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
const int yiter = ORIGHEIGHT / (dimy - yoff) + !!(ORIGHEIGHT % dimy);
|
const int yiter = ORIGHEIGHT / (dimy - yoff) + !!(ORIGHEIGHT % dimy);
|
||||||
const int xoff = (dimx - ORIGWIDTH / xiter) / 2;
|
const int xoff = (dimx - ORIGWIDTH / xiter) / 2;
|
||||||
ncplane_erase(n);
|
ncplane_erase(n);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_load(n, &c, "\xe2\x96\x80"); // upper half block
|
nccell_load(n, &c, "\xe2\x96\x80"); // upper half block
|
||||||
for(size_t y = 0 ; y < ORIGHEIGHT ; y += (yiter * 2)){
|
for(size_t y = 0 ; y < ORIGHEIGHT ; y += (yiter * 2)){
|
||||||
unsigned targy = yoff + y / (yiter * 2);
|
unsigned targy = yoff + y / (yiter * 2);
|
||||||
|
@ -3621,7 +3621,7 @@ makegroup(struct ncplane* title, int y, const char* emoji, const char* name){
|
|||||||
if(n == NULL){
|
if(n == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
y = 1;
|
y = 1;
|
||||||
int x = 1;
|
int x = 1;
|
||||||
while(*emoji){
|
while(*emoji){
|
||||||
|
@ -159,7 +159,7 @@ int normal_demo(struct notcurses* nc, uint64_t startns){
|
|||||||
int r = -1;
|
int r = -1;
|
||||||
struct ncplane* nstd = notcurses_stddim_yx(nc, &dy, &dx);
|
struct ncplane* nstd = notcurses_stddim_yx(nc, &dy, &dx);
|
||||||
ncplane_erase(nstd);
|
ncplane_erase(nstd);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_rgb8(&c, 0x0, 0x0, 0x0);
|
nccell_set_fg_rgb8(&c, 0x0, 0x0, 0x0);
|
||||||
nccell_set_bg_rgb8(&c, 0x0, 0x0, 0x0);
|
nccell_set_bg_rgb8(&c, 0x0, 0x0, 0x0);
|
||||||
ncplane_set_base_cell(nstd, &c);
|
ncplane_set_base_cell(nstd, &c);
|
||||||
|
@ -62,7 +62,7 @@ kill_active_tablet(struct ncreel* pr, tabletctx** tctx){
|
|||||||
static int
|
static int
|
||||||
tabletdraw(struct ncplane* w, int maxy, tabletctx* tctx, unsigned rgb){
|
tabletdraw(struct ncplane* w, int maxy, tabletctx* tctx, unsigned rgb){
|
||||||
char cchbuf[2];
|
char cchbuf[2];
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
int y;
|
int y;
|
||||||
int maxx = ncplane_dim_x(w) - 1;
|
int maxx = ncplane_dim_x(w) - 1;
|
||||||
if(maxy > tctx->lines){
|
if(maxy > tctx->lines){
|
||||||
|
@ -39,7 +39,7 @@ legend(struct notcurses* nc, const char* msg){
|
|||||||
if(n == NULL){
|
if(n == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_rgb8(&c, 0, 0, 0); // darken surrounding characters by half
|
nccell_set_fg_rgb8(&c, 0, 0, 0); // darken surrounding characters by half
|
||||||
nccell_set_fg_alpha(&c, NCALPHA_BLEND);
|
nccell_set_fg_alpha(&c, NCALPHA_BLEND);
|
||||||
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT); // don't touch background
|
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT); // don't touch background
|
||||||
@ -120,7 +120,7 @@ slidepanel(struct notcurses* nc, struct ncplane* stdn){
|
|||||||
// no glyph, we should show underlying glyphs in the default colors. The
|
// no glyph, we should show underlying glyphs in the default colors. The
|
||||||
// background default might be transparent, at the window level (i.e. a copy
|
// background default might be transparent, at the window level (i.e. a copy
|
||||||
// of the underlying desktop).
|
// of the underlying desktop).
|
||||||
nccell c = CELL_CHAR_INITIALIZER(' ');
|
nccell c = NCCELL_CHAR_INITIALIZER(' ');
|
||||||
struct timespec cur;
|
struct timespec cur;
|
||||||
ncplane_set_base_cell(n, &c);
|
ncplane_set_base_cell(n, &c);
|
||||||
clock_gettime(CLOCK_MONOTONIC, &cur);
|
clock_gettime(CLOCK_MONOTONIC, &cur);
|
||||||
|
@ -69,9 +69,9 @@ static int
|
|||||||
draw_block(struct ncplane* nn, uint32_t blockstart){
|
draw_block(struct ncplane* nn, uint32_t blockstart){
|
||||||
unsigned dimx, dimy;
|
unsigned dimx, dimy;
|
||||||
ncplane_dim_yx(nn, &dimy, &dimx);
|
ncplane_dim_yx(nn, &dimy, &dimx);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccells_rounded_box(nn, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl);
|
nccells_rounded_box(nn, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl);
|
||||||
nccell_set_bg_alpha(&ul, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&ul, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&ur, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&ur, NCALPHA_TRANSPARENT);
|
||||||
|
@ -184,7 +184,7 @@ message(struct ncplane* n, int maxy, int maxx, int num, int total,
|
|||||||
ncplane_putegc_yx(n, 4, 17, "┬", NULL);
|
ncplane_putegc_yx(n, 4, 17, "┬", NULL);
|
||||||
ncplane_putegc_yx(n, 5, 17, "│", NULL);
|
ncplane_putegc_yx(n, 5, 17, "│", NULL);
|
||||||
ncplane_putegc_yx(n, 6, 17, "╰", NULL);
|
ncplane_putegc_yx(n, 6, 17, "╰", NULL);
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_load(n, &hl, "─");
|
nccell_load(n, &hl, "─");
|
||||||
nccell_set_fg_rgb8(&hl, 255, 255, 255);
|
nccell_set_fg_rgb8(&hl, 255, 255, 255);
|
||||||
nccell_set_bg_rgb8(&hl, 32, 64, 32);
|
nccell_set_bg_rgb8(&hl, 32, 64, 32);
|
||||||
|
@ -535,7 +535,7 @@ infoplane_notcurses(struct notcurses* nc, const fetched_info* fi,
|
|||||||
ncplane_printf_aligned(infop, 3, NCALIGN_RIGHT, "Shell: %s ", fi->shell ? fi->shell : "n/a");
|
ncplane_printf_aligned(infop, 3, NCALIGN_RIGHT, "Shell: %s ", fi->shell ? fi->shell : "n/a");
|
||||||
if(notcurses_cantruecolor(nc)){
|
if(notcurses_cantruecolor(nc)){
|
||||||
ncplane_printf_aligned(infop, 4, NCALIGN_LEFT, " RGB TERM: %s", fi->term);
|
ncplane_printf_aligned(infop, 4, NCALIGN_LEFT, " RGB TERM: %s", fi->term);
|
||||||
nccell c = CELL_CHAR_INITIALIZER('R');
|
nccell c = NCCELL_CHAR_INITIALIZER('R');
|
||||||
nccell_set_styles(&c, NCSTYLE_BOLD);
|
nccell_set_styles(&c, NCSTYLE_BOLD);
|
||||||
nccell_set_fg_rgb8(&c, 0xf0, 0xa0, 0xa0);
|
nccell_set_fg_rgb8(&c, 0xf0, 0xa0, 0xa0);
|
||||||
ncplane_putc_yx(infop, 4, 1, &c);
|
ncplane_putc_yx(infop, 4, 1, &c);
|
||||||
@ -554,9 +554,9 @@ infoplane_notcurses(struct notcurses* nc, const fetched_info* fi,
|
|||||||
ncplane_printf_aligned(infop, 5, NCALIGN_CENTER, "%s (%d cores)",
|
ncplane_printf_aligned(infop, 5, NCALIGN_CENTER, "%s (%d cores)",
|
||||||
fi->cpu_model ? fi->cpu_model : fallback_cpuinfo(),
|
fi->cpu_model ? fi->cpu_model : fallback_cpuinfo(),
|
||||||
fi->core_count);
|
fi->core_count);
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell ll = CELL_TRIVIAL_INITIALIZER, lr = CELL_TRIVIAL_INITIALIZER;
|
nccell ll = NCCELL_TRIVIAL_INITIALIZER, lr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccells_rounded_box(infop, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
if(nccells_rounded_box(infop, 0, 0, &ul, &ur, &ll, &lr, &hl, &vl)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -365,8 +365,8 @@ rotate_output(ncplane* dst, uint32_t tchan, uint32_t bchan){
|
|||||||
// lower?) having the two channels as fore- and background.
|
// lower?) having the two channels as fore- and background.
|
||||||
static int
|
static int
|
||||||
rotate_2x1_cw(ncplane* src, ncplane* dst, int srcy, int srcx, int dsty, int dstx){
|
rotate_2x1_cw(ncplane* src, ncplane* dst, int srcy, int srcx, int dsty, int dstx){
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(ncplane_at_yx_cell(src, srcy, srcx, &c1) < 0){
|
if(ncplane_at_yx_cell(src, srcy, srcx, &c1) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -406,8 +406,8 @@ rotate_2x1_cw(ncplane* src, ncplane* dst, int srcy, int srcx, int dsty, int dstx
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
rotate_2x1_ccw(ncplane* src, ncplane* dst, int srcy, int srcx, int dsty, int dstx){
|
rotate_2x1_ccw(ncplane* src, ncplane* dst, int srcy, int srcx, int dsty, int dstx){
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(ncplane_at_yx_cell(src, srcy, srcx, &c1) < 0){
|
if(ncplane_at_yx_cell(src, srcy, srcx, &c1) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -330,6 +330,7 @@ typedef struct notcurses {
|
|||||||
|
|
||||||
// we keep a copy of the last rendered frame. this facilitates O(1)
|
// we keep a copy of the last rendered frame. this facilitates O(1)
|
||||||
// notcurses_at_yx() and O(1) damage detection (at the cost of some memory).
|
// notcurses_at_yx() and O(1) damage detection (at the cost of some memory).
|
||||||
|
// FIXME why isn't this just an ncplane rather than ~10 different members?
|
||||||
nccell* lastframe;// last rasterized framebuffer, NULL until first raster
|
nccell* lastframe;// last rasterized framebuffer, NULL until first raster
|
||||||
// the last pile we rasterized. NULL until we've rasterized once. might
|
// the last pile we rasterized. NULL until we've rasterized once. might
|
||||||
// be invalid due to the pile being destroyed; you are only allowed to
|
// be invalid due to the pile being destroyed; you are only allowed to
|
||||||
|
@ -302,7 +302,7 @@ write_header(ncmenu* ncm){
|
|||||||
if(ncplane_cursor_move_yx(ncm->ncp, ypos, 0)){
|
if(ncplane_cursor_move_yx(ncm->ncp, ypos, 0)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
nccell c = CELL_INITIALIZER(' ', 0, ncm->headerchannels);
|
nccell c = NCCELL_INITIALIZER(' ', 0, ncm->headerchannels);
|
||||||
ncplane_set_styles(ncm->ncp, 0);
|
ncplane_set_styles(ncm->ncp, 0);
|
||||||
if(ncplane_putc(ncm->ncp, &c) < 0){
|
if(ncplane_putc(ncm->ncp, &c) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
@ -335,7 +335,7 @@ write_header(ncmenu* ncm){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(ncm->sections[i].shortcut_offset >= 0){
|
if(ncm->sections[i].shortcut_offset >= 0){
|
||||||
nccell cl = CELL_TRIVIAL_INITIALIZER;
|
nccell cl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(ncplane_at_yx_cell(ncm->ncp, ypos, xoff + ncm->sections[i].shortcut_offset, &cl) < 0){
|
if(ncplane_at_yx_cell(ncm->ncp, ypos, xoff + ncm->sections[i].shortcut_offset, &cl) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ ncmenu* ncmenu_create(ncplane* n, const ncmenu_options* opts){
|
|||||||
ret->sectionchannels = opts->sectionchannels;
|
ret->sectionchannels = opts->sectionchannels;
|
||||||
ret->disablechannels = ret->sectionchannels;
|
ret->disablechannels = ret->sectionchannels;
|
||||||
ncchannels_set_fg_rgb(&ret->disablechannels, 0xdddddd);
|
ncchannels_set_fg_rgb(&ret->disablechannels, 0xdddddd);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
ncplane_set_base_cell(ret->ncp, &c);
|
ncplane_set_base_cell(ret->ncp, &c);
|
||||||
@ -519,7 +519,7 @@ int ncmenu_unroll(ncmenu* n, int sectionidx){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(sec->items[i].shortcut_offset >= 0){
|
if(sec->items[i].shortcut_offset >= 0){
|
||||||
nccell cl = CELL_TRIVIAL_INITIALIZER;
|
nccell cl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(ncplane_at_yx_cell(n->ncp, ypos, xpos + 1 + sec->items[i].shortcut_offset, &cl) < 0){
|
if(ncplane_at_yx_cell(n->ncp, ypos, xpos + 1 + sec->items[i].shortcut_offset, &cl) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1966,7 +1966,7 @@ int ncplane_hline_interp(ncplane* n, const nccell* c, unsigned len,
|
|||||||
int deltbg = bg2 - bg1;
|
int deltbg = bg2 - bg1;
|
||||||
int deltbb = bb2 - bb1;
|
int deltbb = bb2 - bb1;
|
||||||
unsigned ret;
|
unsigned ret;
|
||||||
nccell dupc = CELL_TRIVIAL_INITIALIZER;
|
nccell dupc = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccell_duplicate(n, &dupc, c) < 0){
|
if(nccell_duplicate(n, &dupc, c) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2024,7 +2024,7 @@ int ncplane_vline_interp(ncplane* n, const nccell* c, unsigned len,
|
|||||||
unsigned ypos, xpos;
|
unsigned ypos, xpos;
|
||||||
unsigned ret;
|
unsigned ret;
|
||||||
ncplane_cursor_yx(n, &ypos, &xpos);
|
ncplane_cursor_yx(n, &ypos, &xpos);
|
||||||
nccell dupc = CELL_TRIVIAL_INITIALIZER;
|
nccell dupc = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
if(nccell_duplicate(n, &dupc, c) < 0){
|
if(nccell_duplicate(n, &dupc, c) < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3015,7 +3015,7 @@ char* ncplane_contents(ncplane* nc, int begy, int begx, unsigned leny, unsigned
|
|||||||
if(ret){
|
if(ret){
|
||||||
for(unsigned y = ystart, targy = 0 ; y < ystart + leny ; ++y, targy += 2){
|
for(unsigned y = ystart, targy = 0 ; y < ystart + leny ; ++y, targy += 2){
|
||||||
for(unsigned x = xstart, targx = 0 ; x < xstart + lenx ; ++x, ++targx){
|
for(unsigned x = xstart, targx = 0 ; x < xstart + lenx ; ++x, ++targx){
|
||||||
nccell ncl = CELL_TRIVIAL_INITIALIZER;
|
nccell ncl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
// we need ncplane_at_yx_cell() here instead of ncplane_at_yx(),
|
// we need ncplane_at_yx_cell() here instead of ncplane_at_yx(),
|
||||||
// because we should only have one copy of each wide EGC.
|
// because we should only have one copy of each wide EGC.
|
||||||
int clen;
|
int clen;
|
||||||
|
@ -83,7 +83,7 @@ ncselector_body_width(const ncselector* n){
|
|||||||
static int
|
static int
|
||||||
ncselector_draw(ncselector* n){
|
ncselector_draw(ncselector* n){
|
||||||
ncplane_erase(n->ncp);
|
ncplane_erase(n->ncp);
|
||||||
nccell transchar = CELL_TRIVIAL_INITIALIZER;
|
nccell transchar = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
||||||
// if we have a title, we'll draw a riser. the riser is two rows tall, and
|
// if we have a title, we'll draw a riser. the riser is two rows tall, and
|
||||||
@ -163,7 +163,7 @@ ncselector_draw(ncselector* n){
|
|||||||
++yoff;
|
++yoff;
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
const int bodyoffset = dimx - bodywidth + 2;
|
const int bodyoffset = dimx - bodywidth + 2;
|
||||||
@ -187,7 +187,7 @@ ncselector_draw(ncselector* n){
|
|||||||
}
|
}
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(int i = xoff + 1 ; i < (int)dimx - 1 ; ++i){
|
for(int i = xoff + 1 ; i < (int)dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
n->ncp->channels = n->opchannels;
|
n->ncp->channels = n->opchannels;
|
||||||
@ -208,7 +208,7 @@ ncselector_draw(ncselector* n){
|
|||||||
// Bottom line of body (background and possibly down arrow)
|
// Bottom line of body (background and possibly down arrow)
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(int i = xoff + 1 ; i < (int)dimx - 1 ; ++i){
|
for(int i = xoff + 1 ; i < (int)dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||||
@ -611,7 +611,7 @@ ncmultiselector_body_width(const ncmultiselector* n){
|
|||||||
static int
|
static int
|
||||||
ncmultiselector_draw(ncmultiselector* n){
|
ncmultiselector_draw(ncmultiselector* n){
|
||||||
ncplane_erase(n->ncp);
|
ncplane_erase(n->ncp);
|
||||||
nccell transchar = CELL_TRIVIAL_INITIALIZER;
|
nccell transchar = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_set_fg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
||||||
nccell_set_bg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&transchar, NCALPHA_TRANSPARENT);
|
||||||
// if we have a title, we'll draw a riser. the riser is two rows tall, and
|
// if we have a title, we'll draw a riser. the riser is two rows tall, and
|
||||||
@ -678,7 +678,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
|||||||
++yoff;
|
++yoff;
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
const int bodyoffset = dimx - bodywidth + 2;
|
const int bodyoffset = dimx - bodywidth + 2;
|
||||||
@ -699,7 +699,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
|||||||
}
|
}
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
n->ncp->channels = n->descchannels;
|
n->ncp->channels = n->descchannels;
|
||||||
@ -729,7 +729,7 @@ ncmultiselector_draw(ncmultiselector* n){
|
|||||||
// Bottom line of body (background and possibly down arrow)
|
// Bottom line of body (background and possibly down arrow)
|
||||||
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
ncplane_cursor_move_yx(n->ncp, yoff, xoff + 1);
|
||||||
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
for(unsigned i = xoff + 1 ; i < dimx - 1 ; ++i){
|
||||||
nccell transc = CELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
nccell transc = NCCELL_TRIVIAL_INITIALIZER; // fall back to base cell
|
||||||
ncplane_putc(n->ncp, &transc);
|
ncplane_putc(n->ncp, &transc);
|
||||||
}
|
}
|
||||||
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
if(n->maxdisplay && n->maxdisplay < n->itemcount){
|
||||||
|
@ -35,7 +35,7 @@ TEST_CASE("EGCpool") {
|
|||||||
const char* w1 = "\u00e0"; // (utf8: c3 a0)
|
const char* w1 = "\u00e0"; // (utf8: c3 a0)
|
||||||
const char* w2 = "\u0061\u0300"; // (utf8: 61 cc 80)
|
const char* w2 = "\u0061\u0300"; // (utf8: 61 cc 80)
|
||||||
const char* w3 = "\u0061"; // (utf8: 61)
|
const char* w3 = "\u0061"; // (utf8: 61)
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(2 == nccell_load(n_, &c, w1));
|
CHECK(2 == nccell_load(n_, &c, w1));
|
||||||
CHECK(1 == nccell_cols(&c));
|
CHECK(1 == nccell_cols(&c));
|
||||||
CHECK(3 == nccell_load(n_, &c, w2));
|
CHECK(3 == nccell_load(n_, &c, w2));
|
||||||
@ -46,7 +46,7 @@ TEST_CASE("EGCpool") {
|
|||||||
|
|
||||||
SUBCASE("AddAndRemove") {
|
SUBCASE("AddAndRemove") {
|
||||||
const char* wstr = "\U0001242B"; // cuneiform numeric sign nine shar2
|
const char* wstr = "\U0001242B"; // cuneiform numeric sign nine shar2
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto ulen = nccell_load(n_, &c, wstr);
|
auto ulen = nccell_load(n_, &c, wstr);
|
||||||
CHECK(1 == nccell_cols(&c)); // not considered wide, believe it or not
|
CHECK(1 == nccell_cols(&c)); // not considered wide, believe it or not
|
||||||
REQUIRE(0 <= egcpool_stash(&pool_, wstr, ulen));
|
REQUIRE(0 <= egcpool_stash(&pool_, wstr, ulen));
|
||||||
@ -65,8 +65,8 @@ TEST_CASE("EGCpool") {
|
|||||||
|
|
||||||
SUBCASE("AddTwiceRemoveFirst") {
|
SUBCASE("AddTwiceRemoveFirst") {
|
||||||
const char* wstr = "\u8840"; // cjk unified ideograph, wide
|
const char* wstr = "\u8840"; // cjk unified ideograph, wide
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto u1 = nccell_load(n_, &c1, wstr); // bytes consumed
|
auto u1 = nccell_load(n_, &c1, wstr); // bytes consumed
|
||||||
auto u2 = nccell_load(n_, &c2, wstr);
|
auto u2 = nccell_load(n_, &c2, wstr);
|
||||||
int o1 = egcpool_stash(&pool_, wstr, u1);
|
int o1 = egcpool_stash(&pool_, wstr, u1);
|
||||||
@ -90,8 +90,8 @@ TEST_CASE("EGCpool") {
|
|||||||
|
|
||||||
SUBCASE("AddTwiceRemoveSecond") {
|
SUBCASE("AddTwiceRemoveSecond") {
|
||||||
const char* wstr = "\u8840"; // cjk unified ideograph, wide
|
const char* wstr = "\u8840"; // cjk unified ideograph, wide
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto u1 = nccell_load(n_, &c1, wstr); // bytes consumed
|
auto u1 = nccell_load(n_, &c1, wstr); // bytes consumed
|
||||||
auto u2 = nccell_load(n_, &c2, wstr);
|
auto u2 = nccell_load(n_, &c2, wstr);
|
||||||
int o1 = egcpool_stash(&pool_, wstr, u1);
|
int o1 = egcpool_stash(&pool_, wstr, u1);
|
||||||
|
@ -12,7 +12,7 @@ TEST_CASE("Erase") {
|
|||||||
REQUIRE(n_);
|
REQUIRE(n_);
|
||||||
|
|
||||||
// fill the standard plane with 'x's
|
// fill the standard plane with 'x's
|
||||||
nccell nc = CELL_CHAR_INITIALIZER('x');
|
nccell nc = NCCELL_CHAR_INITIALIZER('x');
|
||||||
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &nc));
|
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &nc));
|
||||||
nccell_release(n_, &nc);
|
nccell_release(n_, &nc);
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
@ -40,7 +40,7 @@ TEST_CASE("Fade") {
|
|||||||
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||||
unsigned dimy, dimx;
|
unsigned dimy, dimx;
|
||||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||||
nccell c = CELL_CHAR_INITIALIZER('*');
|
nccell c = NCCELL_CHAR_INITIALIZER('*');
|
||||||
nccell_set_fg_rgb8(&c, 0xff, 0xff, 0xff);
|
nccell_set_fg_rgb8(&c, 0xff, 0xff, 0xff);
|
||||||
unsigned rgb = 0xffffffu;
|
unsigned rgb = 0xffffffu;
|
||||||
CHECK(!ncplane_set_scrolling(n_, true));
|
CHECK(!ncplane_set_scrolling(n_, true));
|
||||||
|
@ -18,7 +18,7 @@ TEST_CASE("Fills") {
|
|||||||
SUBCASE("PolyfillNullGlyph") {
|
SUBCASE("PolyfillNullGlyph") {
|
||||||
unsigned dimx, dimy;
|
unsigned dimx, dimy;
|
||||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 > ncplane_polyfill_yx(n_, dimy, dimx, &c));
|
CHECK(0 > ncplane_polyfill_yx(n_, dimy, dimx, &c));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ TEST_CASE("Fills") {
|
|||||||
SUBCASE("PolyfillOffplane") {
|
SUBCASE("PolyfillOffplane") {
|
||||||
unsigned dimx, dimy;
|
unsigned dimx, dimy;
|
||||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||||
nccell c = CELL_CHAR_INITIALIZER('+');
|
nccell c = NCCELL_CHAR_INITIALIZER('+');
|
||||||
CHECK(0 > ncplane_polyfill_yx(n_, dimy, 0, &c));
|
CHECK(0 > ncplane_polyfill_yx(n_, dimy, 0, &c));
|
||||||
CHECK(0 > ncplane_polyfill_yx(n_, 0, dimx, &c));
|
CHECK(0 > ncplane_polyfill_yx(n_, 0, dimx, &c));
|
||||||
CHECK(0 > ncplane_polyfill_yx(n_, 0, -2, &c));
|
CHECK(0 > ncplane_polyfill_yx(n_, 0, -2, &c));
|
||||||
@ -34,7 +34,7 @@ TEST_CASE("Fills") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("PolyfillOnGlyph") {
|
SUBCASE("PolyfillOnGlyph") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('+');
|
nccell c = NCCELL_CHAR_INITIALIZER('+');
|
||||||
struct ncplane_options nopts = {
|
struct ncplane_options nopts = {
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.x = 0,
|
.x = 0,
|
||||||
@ -61,13 +61,13 @@ TEST_CASE("Fills") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("PolyfillStandardPlane") {
|
SUBCASE("PolyfillStandardPlane") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('-');
|
nccell c = NCCELL_CHAR_INITIALIZER('-');
|
||||||
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &c));
|
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &c));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("PolyfillEmptyPlane") {
|
SUBCASE("PolyfillEmptyPlane") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('+');
|
nccell c = NCCELL_CHAR_INITIALIZER('+');
|
||||||
struct ncplane_options nopts = {
|
struct ncplane_options nopts = {
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.x = 0,
|
.x = 0,
|
||||||
@ -87,7 +87,7 @@ TEST_CASE("Fills") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("PolyfillWalledPlane") {
|
SUBCASE("PolyfillWalledPlane") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('+');
|
nccell c = NCCELL_CHAR_INITIALIZER('+');
|
||||||
struct ncplane_options nopts = {
|
struct ncplane_options nopts = {
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.x = 0,
|
.x = 0,
|
||||||
@ -119,7 +119,7 @@ TEST_CASE("Fills") {
|
|||||||
unsigned dimy, dimx;
|
unsigned dimy, dimx;
|
||||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||||
REQUIRE(0 < ncplane_gradient(n_, -1, -1, dimy, dimx, "M", 0, c, c, c, c));
|
REQUIRE(0 < ncplane_gradient(n_, -1, -1, dimy, dimx, "M", 0, c, c, c, c));
|
||||||
nccell cl = CELL_TRIVIAL_INITIALIZER;
|
nccell cl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
uint64_t channels = 0;
|
uint64_t channels = 0;
|
||||||
ncchannels_set_fg_rgb(&channels, 0x40f040);
|
ncchannels_set_fg_rgb(&channels, 0x40f040);
|
||||||
ncchannels_set_bg_rgb(&channels, 0x40f040);
|
ncchannels_set_bg_rgb(&channels, 0x40f040);
|
||||||
@ -149,7 +149,7 @@ TEST_CASE("Fills") {
|
|||||||
unsigned dimy, dimx;
|
unsigned dimy, dimx;
|
||||||
ncplane_dim_yx(n_, &dimy, &dimx);
|
ncplane_dim_yx(n_, &dimy, &dimx);
|
||||||
REQUIRE(0 < ncplane_gradient(n_, 0, 0, dimy, dimx, "V", 0, ul, ur, ll, lr));
|
REQUIRE(0 < ncplane_gradient(n_, 0, 0, dimy, dimx, "V", 0, ul, ur, ll, lr));
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
uint64_t channels = 0;
|
uint64_t channels = 0;
|
||||||
ncchannels_set_fg_rgb(&channels, 0x40f040);
|
ncchannels_set_fg_rgb(&channels, 0x40f040);
|
||||||
ncchannels_set_bg_rgb(&channels, 0x40f040);
|
ncchannels_set_bg_rgb(&channels, 0x40f040);
|
||||||
@ -248,10 +248,10 @@ TEST_CASE("Fills") {
|
|||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
// attr should change, but not the EGC/color
|
// attr should change, but not the EGC/color
|
||||||
CHECK(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
CHECK(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_on_styles(&c, NCSTYLE_BOLD);
|
nccell_on_styles(&c, NCSTYLE_BOLD);
|
||||||
CHECK(0 < ncplane_format(n_, 0, 0, 0, 0, c.stylemask));
|
CHECK(0 < ncplane_format(n_, 0, 0, 0, 0, c.stylemask));
|
||||||
nccell d = CELL_TRIVIAL_INITIALIZER;
|
nccell d = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
||||||
CHECK(d.stylemask == c.stylemask);
|
CHECK(d.stylemask == c.stylemask);
|
||||||
CHECK(0x444444 == nccell_fg_rgb(&d));
|
CHECK(0x444444 == nccell_fg_rgb(&d));
|
||||||
@ -271,7 +271,7 @@ TEST_CASE("Fills") {
|
|||||||
ncchannels_set_bg_rgb(&channels, 0);
|
ncchannels_set_bg_rgb(&channels, 0);
|
||||||
REQUIRE(0 < ncplane_stain(n_, 0, 0, 7, 7, channels, channels, channels, channels));
|
REQUIRE(0 < ncplane_stain(n_, 0, 0, 7, 7, channels, channels, channels, channels));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
nccell d = CELL_TRIVIAL_INITIALIZER;
|
nccell d = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
for(unsigned y = 0 ; y < 7 ; ++y){
|
for(unsigned y = 0 ; y < 7 ; ++y){
|
||||||
for(unsigned x = 0 ; x < 7 ; ++x){
|
for(unsigned x = 0 ; x < 7 ; ++x){
|
||||||
CHECK(1 == ncplane_at_yx_cell(n_, y, x, &d));
|
CHECK(1 == ncplane_at_yx_cell(n_, y, x, &d));
|
||||||
@ -292,7 +292,7 @@ TEST_CASE("Fills") {
|
|||||||
ncchannels_set_bg_rgb(&channels, 0);
|
ncchannels_set_bg_rgb(&channels, 0);
|
||||||
REQUIRE(0 < ncplane_gradient(n_, 0, 0, 0, 0, "A", 0, channels, channels, channels, channels));
|
REQUIRE(0 < ncplane_gradient(n_, 0, 0, 0, 0, "A", 0, channels, channels, channels, channels));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
nccell d = CELL_TRIVIAL_INITIALIZER;
|
nccell d = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
||||||
CHECK(channels == d.channels);
|
CHECK(channels == d.channels);
|
||||||
REQUIRE(cell_simple_p(&d));
|
REQUIRE(cell_simple_p(&d));
|
||||||
@ -312,7 +312,7 @@ TEST_CASE("Fills") {
|
|||||||
ncchannels_set_bg_rgb(&chan2, 0);
|
ncchannels_set_bg_rgb(&chan2, 0);
|
||||||
CHECK(0 < ncplane_gradient(n_, 0, 0, 0, 3, "A", 0, chan1, chan2, chan1, chan2));
|
CHECK(0 < ncplane_gradient(n_, 0, 0, 0, 3, "A", 0, chan1, chan2, chan1, chan2));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
nccell d = CELL_TRIVIAL_INITIALIZER;
|
nccell d = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &d));
|
||||||
CHECK(chan1 == d.channels);
|
CHECK(chan1 == d.channels);
|
||||||
CHECK(cell_simple_p(&d));
|
CHECK(cell_simple_p(&d));
|
||||||
@ -366,8 +366,8 @@ TEST_CASE("Fills") {
|
|||||||
// make sure glyphs replace nulls
|
// make sure glyphs replace nulls
|
||||||
CHECK(0 < ncplane_putstr(p1, "0123456789"));
|
CHECK(0 < ncplane_putstr(p1, "0123456789"));
|
||||||
CHECK(0 == ncplane_mergedown_simple(p1, n_));
|
CHECK(0 == ncplane_mergedown_simple(p1, n_));
|
||||||
nccell cbase = CELL_TRIVIAL_INITIALIZER;
|
nccell cbase = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cp = CELL_TRIVIAL_INITIALIZER;
|
nccell cp = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
for(int i = 0 ; i < 10 ; ++i){
|
for(int i = 0 ; i < 10 ; ++i){
|
||||||
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
||||||
CHECK(0 < ncplane_at_yx_cell(p1, 0, i, &cp));
|
CHECK(0 < ncplane_at_yx_cell(p1, 0, i, &cp));
|
||||||
@ -411,8 +411,8 @@ TEST_CASE("Fills") {
|
|||||||
// make sure glyphs replace nulls
|
// make sure glyphs replace nulls
|
||||||
CHECK(0 < ncplane_putstr(p1, "█▀▄▌▐🞵🞶🞷🞸🞹"));
|
CHECK(0 < ncplane_putstr(p1, "█▀▄▌▐🞵🞶🞷🞸🞹"));
|
||||||
CHECK(0 == ncplane_mergedown_simple(p1, n_));
|
CHECK(0 == ncplane_mergedown_simple(p1, n_));
|
||||||
nccell cbase = CELL_TRIVIAL_INITIALIZER;
|
nccell cbase = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cp = CELL_TRIVIAL_INITIALIZER;
|
nccell cp = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
for(int i = 0 ; i < 10 ; ++i){
|
for(int i = 0 ; i < 10 ; ++i){
|
||||||
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
||||||
CHECK(0 < ncplane_at_yx_cell(p1, 0, i, &cp));
|
CHECK(0 < ncplane_at_yx_cell(p1, 0, i, &cp));
|
||||||
@ -425,7 +425,7 @@ TEST_CASE("Fills") {
|
|||||||
// make sure glyphs replace glyps
|
// make sure glyphs replace glyps
|
||||||
CHECK(0 < ncplane_putstr(p3, "🞵🞶🞷🞸🞹█▀▄▌▐"));
|
CHECK(0 < ncplane_putstr(p3, "🞵🞶🞷🞸🞹█▀▄▌▐"));
|
||||||
CHECK(0 == ncplane_mergedown_simple(p3, n_));
|
CHECK(0 == ncplane_mergedown_simple(p3, n_));
|
||||||
nccell c3 = CELL_TRIVIAL_INITIALIZER;
|
nccell c3 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
for(int i = 0 ; i < 10 ; ++i){
|
for(int i = 0 ; i < 10 ; ++i){
|
||||||
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
CHECK(0 < ncplane_at_yx_cell(n_, 0, i, &cbase));
|
||||||
CHECK(0 < ncplane_at_yx_cell(p3, 0, i, &c3));
|
CHECK(0 < ncplane_at_yx_cell(p3, 0, i, &c3));
|
||||||
@ -463,7 +463,7 @@ TEST_CASE("Fills") {
|
|||||||
};
|
};
|
||||||
struct ncplane* p1 = ncplane_create(n_, &nopts);
|
struct ncplane* p1 = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(p1);
|
REQUIRE(p1);
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < nccell_load(p1, &c1, "█"));
|
CHECK(0 < nccell_load(p1, &c1, "█"));
|
||||||
CHECK(0 == nccell_set_bg_rgb(&c1, 0x00ff00));
|
CHECK(0 == nccell_set_bg_rgb(&c1, 0x00ff00));
|
||||||
CHECK(0 == nccell_set_fg_rgb(&c1, 0x0000ff));
|
CHECK(0 == nccell_set_fg_rgb(&c1, 0x0000ff));
|
||||||
@ -482,7 +482,7 @@ TEST_CASE("Fills") {
|
|||||||
};
|
};
|
||||||
auto p2 = ncplane_create(n_, &n2opts);
|
auto p2 = ncplane_create(n_, &n2opts);
|
||||||
REQUIRE(p2);
|
REQUIRE(p2);
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < nccell_load(p2, &c2, "🞶"));
|
CHECK(0 < nccell_load(p2, &c2, "🞶"));
|
||||||
CHECK(0 == nccell_set_bg_rgb(&c2, 0x00ffff));
|
CHECK(0 == nccell_set_bg_rgb(&c2, 0x00ffff));
|
||||||
CHECK(0 == nccell_set_fg_rgb(&c2, 0xff00ff));
|
CHECK(0 == nccell_set_fg_rgb(&c2, 0xff00ff));
|
||||||
@ -549,14 +549,14 @@ TEST_CASE("Fills") {
|
|||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
for(unsigned y = 0 ; y < DIMY ; ++y){
|
for(unsigned y = 0 ; y < DIMY ; ++y){
|
||||||
for(unsigned x = 0 ; x < DIMX ; ++x){
|
for(unsigned x = 0 ; x < DIMX ; ++x){
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_at_yx_cell(p1, y, x, &c1));
|
CHECK(0 < ncplane_at_yx_cell(p1, y, x, &c1));
|
||||||
if(y < 1 || y > 5 || x < 1 || x > 5){
|
if(y < 1 || y > 5 || x < 1 || x > 5){
|
||||||
auto cstr = nccell_strdup(p1, &c1);
|
auto cstr = nccell_strdup(p1, &c1);
|
||||||
CHECK(0 == strcmp(cstr, "▀"));
|
CHECK(0 == strcmp(cstr, "▀"));
|
||||||
free(cstr);
|
free(cstr);
|
||||||
}else{
|
}else{
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_at_yx_cell(p2, y - 1, x - 1, &c2));
|
CHECK(0 < ncplane_at_yx_cell(p2, y - 1, x - 1, &c2));
|
||||||
CHECK(0 == nccellcmp(p1, &c1, p2, &c2));
|
CHECK(0 == nccellcmp(p1, &c1, p2, &c2));
|
||||||
nccell_release(p2, &c2);
|
nccell_release(p2, &c2);
|
||||||
|
@ -36,9 +36,9 @@ TEST_CASE("Geometry") {
|
|||||||
};
|
};
|
||||||
auto n = ncplane_create(n_, &nopts);
|
auto n = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(n);
|
REQUIRE(n);
|
||||||
nccell tl = CELL_TRIVIAL_INITIALIZER, tr = CELL_TRIVIAL_INITIALIZER;
|
nccell tl = NCCELL_TRIVIAL_INITIALIZER, tr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell bl = CELL_TRIVIAL_INITIALIZER, br = CELL_TRIVIAL_INITIALIZER;
|
nccell bl = NCCELL_TRIVIAL_INITIALIZER, br = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == nccells_double_box(n, 0, 0, &tl, &tr, &bl, &br, &hl, &vl));
|
CHECK(0 == nccells_double_box(n, 0, 0, &tl, &tr, &bl, &br, &hl, &vl));
|
||||||
CHECK(0 <= ncplane_perimeter(n, &tl, &tr, &bl, &br, &hl, &vl, 0));
|
CHECK(0 <= ncplane_perimeter(n, &tl, &tr, &bl, &br, &hl, &vl, 0));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
@ -83,9 +83,9 @@ TEST_CASE("Geometry") {
|
|||||||
};
|
};
|
||||||
auto n = ncplane_create(n_, &nopts);
|
auto n = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(n);
|
REQUIRE(n);
|
||||||
nccell tl = CELL_TRIVIAL_INITIALIZER, tr = CELL_TRIVIAL_INITIALIZER;
|
nccell tl = NCCELL_TRIVIAL_INITIALIZER, tr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell bl = CELL_TRIVIAL_INITIALIZER, br = CELL_TRIVIAL_INITIALIZER;
|
nccell bl = NCCELL_TRIVIAL_INITIALIZER, br = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == nccells_double_box(n, 0, 0, &tl, &tr, &bl, &br, &hl, &vl));
|
CHECK(0 == nccells_double_box(n, 0, 0, &tl, &tr, &bl, &br, &hl, &vl));
|
||||||
CHECK(0 <= ncplane_perimeter(n, &tl, &tr, &bl, &br, &hl, &vl, 0));
|
CHECK(0 <= ncplane_perimeter(n, &tl, &tr, &bl, &br, &hl, &vl, 0));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
@ -40,7 +40,7 @@ TEST_CASE("Palette256") {
|
|||||||
|
|
||||||
// when we set a palette index, it ought change us from using default
|
// when we set a palette index, it ought change us from using default
|
||||||
SUBCASE("FAttributes") {
|
SUBCASE("FAttributes") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(nccell_fg_default_p(&c));
|
CHECK(nccell_fg_default_p(&c));
|
||||||
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_fg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
||||||
@ -51,7 +51,7 @@ TEST_CASE("Palette256") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("BAttributes") {
|
SUBCASE("BAttributes") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(nccell_bg_default_p(&c));
|
CHECK(nccell_bg_default_p(&c));
|
||||||
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
nccell_set_bg_alpha(&c, NCALPHA_TRANSPARENT);
|
||||||
CHECK(0 == nccell_set_bg_palindex(&c, 0x20));
|
CHECK(0 == nccell_set_bg_palindex(&c, 0x20));
|
||||||
@ -63,13 +63,13 @@ TEST_CASE("Palette256") {
|
|||||||
|
|
||||||
// write it to an ncplane, and verify attributes via reflection
|
// write it to an ncplane, and verify attributes via reflection
|
||||||
SUBCASE("PutCAttrs") {
|
SUBCASE("PutCAttrs") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(1 == nccell_load_char(n_, &c, 'X'));
|
CHECK(1 == nccell_load_char(n_, &c, 'X'));
|
||||||
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
||||||
CHECK(0 == nccell_set_bg_palindex(&c, 0x40));
|
CHECK(0 == nccell_set_bg_palindex(&c, 0x40));
|
||||||
CHECK(1 == ncplane_putc_yx(n_, 0, 0, &c));
|
CHECK(1 == ncplane_putc_yx(n_, 0, 0, &c));
|
||||||
nccell_release(n_, &c);
|
nccell_release(n_, &c);
|
||||||
nccell r = CELL_TRIVIAL_INITIALIZER;
|
nccell r = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_at_yx_cell(n_, 0, 0, &r));
|
CHECK(0 < ncplane_at_yx_cell(n_, 0, 0, &r));
|
||||||
CHECK(nccell_fg_palindex_p(&r));
|
CHECK(nccell_fg_palindex_p(&r));
|
||||||
CHECK(nccell_bg_palindex_p(&r));
|
CHECK(nccell_bg_palindex_p(&r));
|
||||||
@ -81,7 +81,7 @@ TEST_CASE("Palette256") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("RenderCAttrs") {
|
SUBCASE("RenderCAttrs") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_load_char(n_, &c, 'X');
|
nccell_load_char(n_, &c, 'X');
|
||||||
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
CHECK(0 == nccell_set_fg_palindex(&c, 0x20));
|
||||||
CHECK(0 == nccell_set_bg_palindex(&c, 0x40));
|
CHECK(0 == nccell_set_bg_palindex(&c, 0x40));
|
||||||
@ -90,7 +90,7 @@ TEST_CASE("Palette256") {
|
|||||||
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
||||||
nccell_release(n_, &c);
|
nccell_release(n_, &c);
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
nccell r = CELL_TRIVIAL_INITIALIZER;
|
nccell r = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto egc = notcurses_at_yx(nc_, 0, 0, &r.stylemask, &r.channels);
|
auto egc = notcurses_at_yx(nc_, 0, 0, &r.stylemask, &r.channels);
|
||||||
CHECK(nullptr != egc);
|
CHECK(nullptr != egc);
|
||||||
free(egc);
|
free(egc);
|
||||||
|
@ -54,9 +54,9 @@ TEST_CASE("Piles") {
|
|||||||
CHECK(np == ncplane_parent_const(np));
|
CHECK(np == ncplane_parent_const(np));
|
||||||
CHECK(1 == ncplane_y(np));
|
CHECK(1 == ncplane_y(np));
|
||||||
CHECK(1 == ncplane_x(np));
|
CHECK(1 == ncplane_x(np));
|
||||||
nccell c = CELL_CHAR_INITIALIZER('X');
|
nccell c = NCCELL_CHAR_INITIALIZER('X');
|
||||||
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
||||||
nccell o = CELL_CHAR_INITIALIZER('O');
|
nccell o = NCCELL_CHAR_INITIALIZER('O');
|
||||||
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &o));
|
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &o));
|
||||||
CHECK(0 == ncpile_render(np));
|
CHECK(0 == ncpile_render(np));
|
||||||
CHECK(0 == ncpile_render(n_));
|
CHECK(0 == ncpile_render(n_));
|
||||||
@ -91,9 +91,9 @@ TEST_CASE("Piles") {
|
|||||||
CHECK(np == ncplane_parent_const(np));
|
CHECK(np == ncplane_parent_const(np));
|
||||||
CHECK(-1 == ncplane_y(np));
|
CHECK(-1 == ncplane_y(np));
|
||||||
CHECK(-1 == ncplane_x(np));
|
CHECK(-1 == ncplane_x(np));
|
||||||
nccell c = CELL_CHAR_INITIALIZER('X');
|
nccell c = NCCELL_CHAR_INITIALIZER('X');
|
||||||
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
||||||
nccell o = CELL_CHAR_INITIALIZER('O');
|
nccell o = NCCELL_CHAR_INITIALIZER('O');
|
||||||
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &o));
|
CHECK(0 < ncplane_polyfill_yx(n_, 0, 0, &o));
|
||||||
CHECK(0 == ncpile_render(np));
|
CHECK(0 == ncpile_render(np));
|
||||||
CHECK(0 == ncpile_render(n_));
|
CHECK(0 == ncpile_render(n_));
|
||||||
|
@ -116,7 +116,7 @@ TEST_CASE("Plane") {
|
|||||||
// Verify we can emit a NUL character, and it advances the cursor after
|
// Verify we can emit a NUL character, and it advances the cursor after
|
||||||
// wiping out whatever we printed it atop.
|
// wiping out whatever we printed it atop.
|
||||||
SUBCASE("EmitNULCell") {
|
SUBCASE("EmitNULCell") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('a');
|
nccell c = NCCELL_CHAR_INITIALIZER('a');
|
||||||
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
||||||
auto egc = ncplane_at_yx(n_, 0, 0, nullptr, nullptr);
|
auto egc = ncplane_at_yx(n_, 0, 0, nullptr, nullptr);
|
||||||
CHECK(0 == strcmp("a", egc));
|
CHECK(0 == strcmp("a", egc));
|
||||||
@ -126,7 +126,7 @@ TEST_CASE("Plane") {
|
|||||||
CHECK(0 == y);
|
CHECK(0 == y);
|
||||||
CHECK(1 == x);
|
CHECK(1 == x);
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
c = CELL_TRIVIAL_INITIALIZER;
|
c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
CHECK(0 < ncplane_putc_yx(n_, 0, 0, &c));
|
||||||
egc = ncplane_at_yx(n_, 0, 0, nullptr, nullptr);
|
egc = ncplane_at_yx(n_, 0, 0, nullptr, nullptr);
|
||||||
CHECK(0 == strcmp("", egc));
|
CHECK(0 == strcmp("", egc));
|
||||||
@ -353,9 +353,9 @@ TEST_CASE("Plane") {
|
|||||||
const char* w1 = "à"; // U+00E0, U+0000 (c3 a0)
|
const char* w1 = "à"; // U+00E0, U+0000 (c3 a0)
|
||||||
const char* w2 = "à"; // U+0061, U+0300, U+0000 (61 cc 80)
|
const char* w2 = "à"; // U+0061, U+0300, U+0000 (61 cc 80)
|
||||||
const char* w3 = "a"; // U+0061, U+0000 (61)
|
const char* w3 = "a"; // U+0061, U+0000 (61)
|
||||||
nccell cell1 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell2 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell3 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell3 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto u1 = nccell_load(n_, &cell1, w1);
|
auto u1 = nccell_load(n_, &cell1, w1);
|
||||||
auto u2 = nccell_load(n_, &cell2, w2);
|
auto u2 = nccell_load(n_, &cell2, w2);
|
||||||
auto u3 = nccell_load(n_, &cell3, w3);
|
auto u3 = nccell_load(n_, &cell3, w3);
|
||||||
@ -371,18 +371,18 @@ TEST_CASE("Plane") {
|
|||||||
const char* w1 = "à"; // U+00E0, U+0000 (c3 a0)
|
const char* w1 = "à"; // U+00E0, U+0000 (c3 a0)
|
||||||
const char* w2 = "à"; // U+0061, U+0300, U+0000 (61 cc 80)
|
const char* w2 = "à"; // U+0061, U+0300, U+0000 (61 cc 80)
|
||||||
const char* w3 = "a"; // U+0061, U+0000 (61)
|
const char* w3 = "a"; // U+0061, U+0000 (61)
|
||||||
nccell cell1 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell2 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell3 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell3 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto u1 = nccell_load(n_, &cell1, w1);
|
auto u1 = nccell_load(n_, &cell1, w1);
|
||||||
auto u2 = nccell_load(n_, &cell2, w2);
|
auto u2 = nccell_load(n_, &cell2, w2);
|
||||||
auto u3 = nccell_load(n_, &cell3, w3);
|
auto u3 = nccell_load(n_, &cell3, w3);
|
||||||
REQUIRE(2 == u1);
|
REQUIRE(2 == u1);
|
||||||
REQUIRE(3 == u2);
|
REQUIRE(3 == u2);
|
||||||
REQUIRE(1 == u3);
|
REQUIRE(1 == u3);
|
||||||
nccell cell4 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell4 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell5 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell5 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell cell6 = CELL_TRIVIAL_INITIALIZER;
|
nccell cell6 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == nccell_duplicate(n_, &cell4, &cell1));
|
CHECK(0 == nccell_duplicate(n_, &cell4, &cell1));
|
||||||
CHECK(0 == nccell_duplicate(n_, &cell5, &cell2));
|
CHECK(0 == nccell_duplicate(n_, &cell5, &cell2));
|
||||||
CHECK(0 == nccell_duplicate(n_, &cell6, &cell3));
|
CHECK(0 == nccell_duplicate(n_, &cell6, &cell3));
|
||||||
@ -397,8 +397,8 @@ TEST_CASE("Plane") {
|
|||||||
SUBCASE("CellMultiColumn") {
|
SUBCASE("CellMultiColumn") {
|
||||||
const char* w1 = "\xf0\x9f\x91\xa9"; // U+1F469 WOMAN
|
const char* w1 = "\xf0\x9f\x91\xa9"; // U+1F469 WOMAN
|
||||||
const char* w2 = "N";
|
const char* w2 = "N";
|
||||||
nccell c1 = CELL_TRIVIAL_INITIALIZER;
|
nccell c1 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c2 = CELL_TRIVIAL_INITIALIZER;
|
nccell c2 = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
auto u1 = nccell_load(n_, &c1, w1);
|
auto u1 = nccell_load(n_, &c1, w1);
|
||||||
auto u2 = nccell_load(n_, &c2, w2);
|
auto u2 = nccell_load(n_, &c2, w2);
|
||||||
REQUIRE(0 < u1);
|
REQUIRE(0 < u1);
|
||||||
@ -596,7 +596,7 @@ TEST_CASE("Plane") {
|
|||||||
ncplane_set_styles(n_, NCSCALE_NONE);
|
ncplane_set_styles(n_, NCSCALE_NONE);
|
||||||
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||||
REQUIRE(0 < ncplane_putstr(n_, STR1));
|
REQUIRE(0 < ncplane_putstr(n_, STR1));
|
||||||
nccell testcell = CELL_TRIVIAL_INITIALIZER;
|
nccell testcell = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
REQUIRE(0 == ncplane_at_cursor_cell(n_, &testcell)); // want nothing at the cursor
|
REQUIRE(0 == ncplane_at_cursor_cell(n_, &testcell)); // want nothing at the cursor
|
||||||
CHECK(0 == testcell.gcluster);
|
CHECK(0 == testcell.gcluster);
|
||||||
CHECK(0 == testcell.stylemask);
|
CHECK(0 == testcell.stylemask);
|
||||||
@ -634,7 +634,7 @@ TEST_CASE("Plane") {
|
|||||||
ncplane_set_styles(n_, NCSTYLE_NONE);
|
ncplane_set_styles(n_, NCSTYLE_NONE);
|
||||||
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||||
REQUIRE(0 < ncplane_putstr(n_, STR1));
|
REQUIRE(0 < ncplane_putstr(n_, STR1));
|
||||||
nccell testcell = CELL_TRIVIAL_INITIALIZER;
|
nccell testcell = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_at_cursor_cell(n_, &testcell); // should be nothing at the cursor
|
ncplane_at_cursor_cell(n_, &testcell); // should be nothing at the cursor
|
||||||
CHECK(0 == testcell.gcluster);
|
CHECK(0 == testcell.gcluster);
|
||||||
CHECK(0 == testcell.stylemask);
|
CHECK(0 == testcell.stylemask);
|
||||||
@ -684,7 +684,7 @@ TEST_CASE("Plane") {
|
|||||||
unsigned newx;
|
unsigned newx;
|
||||||
ncplane_cursor_yx(n_, &y, &newx);
|
ncplane_cursor_yx(n_, &y, &newx);
|
||||||
CHECK(newx == x);
|
CHECK(newx == x);
|
||||||
nccell testcell = CELL_TRIVIAL_INITIALIZER;
|
nccell testcell = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == ncplane_cursor_move_yx(n_, y - 2, x - 1));
|
CHECK(0 == ncplane_cursor_move_yx(n_, y - 2, x - 1));
|
||||||
REQUIRE(1 == ncplane_at_cursor_cell(n_, &testcell));
|
REQUIRE(1 == ncplane_at_cursor_cell(n_, &testcell));
|
||||||
CHECK(testcell.gcluster == htole(STR1[strlen(STR1) - 1]));
|
CHECK(testcell.gcluster == htole(STR1[strlen(STR1) - 1]));
|
||||||
@ -839,13 +839,13 @@ TEST_CASE("Plane") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("Perimeter") {
|
SUBCASE("Perimeter") {
|
||||||
nccell c = CELL_CHAR_INITIALIZER('X');
|
nccell c = NCCELL_CHAR_INITIALIZER('X');
|
||||||
CHECK(0 == ncplane_perimeter(n_, &c, &c, &c, &c, &c, &c, 0));
|
CHECK(0 == ncplane_perimeter(n_, &c, &c, &c, &c, &c, &c, 0));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("EGCStained") {
|
SUBCASE("EGCStained") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||||
CHECK(1 == ncplane_putegc(n_, "A", nullptr));
|
CHECK(1 == ncplane_putegc(n_, "A", nullptr));
|
||||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x888888));
|
CHECK(0 == ncplane_set_fg_rgb(n_, 0x888888));
|
||||||
|
@ -69,9 +69,9 @@ TEST_CASE("Rotate") {
|
|||||||
CHECK(0 == ncchannels_set_fg_alpha(&channels, NCALPHA_TRANSPARENT));
|
CHECK(0 == ncchannels_set_fg_alpha(&channels, NCALPHA_TRANSPARENT));
|
||||||
CHECK(0 == ncchannels_set_bg_alpha(&channels, NCALPHA_TRANSPARENT));
|
CHECK(0 == ncchannels_set_bg_alpha(&channels, NCALPHA_TRANSPARENT));
|
||||||
REQUIRE(0 >= ncplane_set_base(testn, "", 0, channels));
|
REQUIRE(0 >= ncplane_set_base(testn, "", 0, channels));
|
||||||
nccell tl = CELL_TRIVIAL_INITIALIZER, tr = CELL_TRIVIAL_INITIALIZER;
|
nccell tl = NCCELL_TRIVIAL_INITIALIZER, tr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell bl = CELL_TRIVIAL_INITIALIZER, br = CELL_TRIVIAL_INITIALIZER;
|
nccell bl = NCCELL_TRIVIAL_INITIALIZER, br = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(-1 < nccell_prime(testn, &tl, "█", 0, ul));
|
CHECK(-1 < nccell_prime(testn, &tl, "█", 0, ul));
|
||||||
CHECK(-1 < nccell_prime(testn, &tr, "█", 0, ur));
|
CHECK(-1 < nccell_prime(testn, &tr, "█", 0, ur));
|
||||||
CHECK(-1 < nccell_prime(testn, &bl, "█", 0, ll));
|
CHECK(-1 < nccell_prime(testn, &bl, "█", 0, ll));
|
||||||
|
@ -150,9 +150,9 @@ TEST_CASE("Scrolling") {
|
|||||||
REQUIRE(n);
|
REQUIRE(n);
|
||||||
// verify that the new plane was started without scrolling
|
// verify that the new plane was started without scrolling
|
||||||
CHECK(!ncplane_set_scrolling(n, true));
|
CHECK(!ncplane_set_scrolling(n, true));
|
||||||
nccell ul = CELL_TRIVIAL_INITIALIZER, ur = CELL_TRIVIAL_INITIALIZER;
|
nccell ul = NCCELL_TRIVIAL_INITIALIZER, ur = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell dl = CELL_TRIVIAL_INITIALIZER, dr = CELL_TRIVIAL_INITIALIZER;
|
nccell dl = NCCELL_TRIVIAL_INITIALIZER, dr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell hl = CELL_TRIVIAL_INITIALIZER, vl = CELL_TRIVIAL_INITIALIZER;
|
nccell hl = NCCELL_TRIVIAL_INITIALIZER, vl = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 == nccells_double_box(n, 0, 0, &ul, &ur, &dl, &dr, &hl, &vl));
|
CHECK(0 == nccells_double_box(n, 0, 0, &ul, &ur, &dl, &dr, &hl, &vl));
|
||||||
CHECK(0 > ncplane_box_sized(n, &ul, &ur, &dl, &dr, &hl, &vl, 2, 25, 0));
|
CHECK(0 > ncplane_box_sized(n, &ul, &ur, &dl, &dr, &hl, &vl, 2, 25, 0));
|
||||||
CHECK(0 > ncplane_box_sized(n, &ul, &ur, &dl, &dr, &hl, &vl, 2, 21, 0));
|
CHECK(0 > ncplane_box_sized(n, &ul, &ur, &dl, &dr, &hl, &vl, 2, 21, 0));
|
||||||
@ -269,7 +269,7 @@ TEST_CASE("Scrolling") {
|
|||||||
ncplane_set_scrolling(n_, true);
|
ncplane_set_scrolling(n_, true);
|
||||||
auto np = ncplane_create(n_, &nopts);
|
auto np = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(nullptr != np);
|
REQUIRE(nullptr != np);
|
||||||
nccell c = CELL_INITIALIZER('a', 0, NCCHANNELS_INITIALIZER(0xbb, 0, 0xbb, 0, 0, 0));
|
nccell c = NCCELL_INITIALIZER('a', 0, NCCHANNELS_INITIALIZER(0xbb, 0, 0xbb, 0, 0, 0));
|
||||||
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
||||||
CHECK(0 == ncplane_cursor_move_yx(n_, ncplane_dim_y(n_) - 1, 0));
|
CHECK(0 == ncplane_cursor_move_yx(n_, ncplane_dim_y(n_) - 1, 0));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
@ -297,7 +297,7 @@ TEST_CASE("Scrolling") {
|
|||||||
ncplane_set_scrolling(n_, true);
|
ncplane_set_scrolling(n_, true);
|
||||||
auto np = ncplane_create(n_, &nopts);
|
auto np = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(nullptr != np);
|
REQUIRE(nullptr != np);
|
||||||
nccell c = CELL_INITIALIZER('a', 0, NCCHANNELS_INITIALIZER(0xbb, 0, 0xbb, 0, 0, 0));
|
nccell c = NCCELL_INITIALIZER('a', 0, NCCHANNELS_INITIALIZER(0xbb, 0, 0xbb, 0, 0, 0));
|
||||||
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
CHECK(0 < ncplane_polyfill_yx(np, 0, 0, &c));
|
||||||
CHECK(0 == ncplane_cursor_move_yx(n_, ncplane_dim_y(n_) - 1, 0));
|
CHECK(0 == ncplane_cursor_move_yx(n_, ncplane_dim_y(n_) - 1, 0));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
@ -88,7 +88,7 @@ TEST_CASE("Wide") {
|
|||||||
int x = 0;
|
int x = 0;
|
||||||
for(auto & tcell : tcells){
|
for(auto & tcell : tcells){
|
||||||
CHECK(0 == ncplane_cursor_move_yx(n_, 0, x));
|
CHECK(0 == ncplane_cursor_move_yx(n_, 0, x));
|
||||||
nccell testcell = CELL_TRIVIAL_INITIALIZER;
|
nccell testcell = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_at_cursor_cell(n_, &testcell));
|
CHECK(0 < ncplane_at_cursor_cell(n_, &testcell));
|
||||||
CHECK(!strcmp(nccell_extended_gcluster(n_, &tcell), nccell_extended_gcluster(n_, &testcell)));
|
CHECK(!strcmp(nccell_extended_gcluster(n_, &tcell), nccell_extended_gcluster(n_, &testcell)));
|
||||||
CHECK(0 == testcell.stylemask);
|
CHECK(0 == testcell.stylemask);
|
||||||
@ -117,7 +117,7 @@ TEST_CASE("Wide") {
|
|||||||
CHECK(1 == y);
|
CHECK(1 == y);
|
||||||
CHECK(2 == x);
|
CHECK(2 == x);
|
||||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, w, nullptr));
|
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, w, nullptr));
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < nccell_load(n_, &c, w));
|
CHECK(0 < nccell_load(n_, &c, w));
|
||||||
CHECK(0 < ncplane_putc_yx(n_, 1, 0, &c));
|
CHECK(0 < ncplane_putc_yx(n_, 1, 0, &c));
|
||||||
nccell_release(n_, &c);
|
nccell_release(n_, &c);
|
||||||
@ -147,7 +147,7 @@ TEST_CASE("Wide") {
|
|||||||
ncplane_cursor_yx(n_, &y, &x);
|
ncplane_cursor_yx(n_, &y, &x);
|
||||||
CHECK(0 == y);
|
CHECK(0 == y);
|
||||||
CHECK(1 + cols2 == x);
|
CHECK(1 + cols2 == x);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_at_yx_cell(n_, 0, 0, &c);
|
ncplane_at_yx_cell(n_, 0, 0, &c);
|
||||||
if(cols1 > 1){
|
if(cols1 > 1){
|
||||||
CHECK(0 == c.gcluster); // should be nothing
|
CHECK(0 == c.gcluster); // should be nothing
|
||||||
@ -173,7 +173,7 @@ TEST_CASE("Wide") {
|
|||||||
ncplane_cursor_yx(n_, &y, &x);
|
ncplane_cursor_yx(n_, &y, &x);
|
||||||
CHECK(0 == y);
|
CHECK(0 == y);
|
||||||
CHECK(3 == x);
|
CHECK(3 == x);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_at_yx_cell(n_, 0, 0, &c);
|
ncplane_at_yx_cell(n_, 0, 0, &c);
|
||||||
if(ncstrwidth(wbashedl, NULL, NULL) > 1){
|
if(ncstrwidth(wbashedl, NULL, NULL) > 1){
|
||||||
CHECK(0 == c.gcluster); // should be nothing
|
CHECK(0 == c.gcluster); // should be nothing
|
||||||
@ -202,7 +202,7 @@ TEST_CASE("Wide") {
|
|||||||
ncplane_cursor_yx(n_, &y, &x);
|
ncplane_cursor_yx(n_, &y, &x);
|
||||||
CHECK(0 == y);
|
CHECK(0 == y);
|
||||||
CHECK(3 == x);
|
CHECK(3 == x);
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_at_yx_cell(n_, 0, 0, &c);
|
ncplane_at_yx_cell(n_, 0, 0, &c);
|
||||||
CHECK(0 == strcmp(nccell_extended_gcluster(n_, &c), SNAKE));
|
CHECK(0 == strcmp(nccell_extended_gcluster(n_, &c), SNAKE));
|
||||||
ncplane_at_yx_cell(n_, 0, 1, &c);
|
ncplane_at_yx_cell(n_, 0, 1, &c);
|
||||||
@ -235,7 +235,7 @@ TEST_CASE("Wide") {
|
|||||||
CHECK(0 == ncplane_rounded_box_sized(ncp, 0, 0, 3, 4, 0));
|
CHECK(0 == ncplane_rounded_box_sized(ncp, 0, 0, 3, 4, 0));
|
||||||
CHECK(ncstrwidth(SCORPION, NULL, NULL) == ncplane_putegc_yx(ncp, 1, 1, SCORPION, nullptr));
|
CHECK(ncstrwidth(SCORPION, NULL, NULL) == ncplane_putegc_yx(ncp, 1, 1, SCORPION, nullptr));
|
||||||
CHECK(0 == notcurses_render(nc_));
|
CHECK(0 == notcurses_render(nc_));
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(0 < ncplane_at_yx_cell(ncp, 1, 0, &c));
|
CHECK(0 < ncplane_at_yx_cell(ncp, 1, 0, &c));
|
||||||
CHECK(!strcmp(nccell_extended_gcluster(ncp, &c), "│"));
|
CHECK(!strcmp(nccell_extended_gcluster(ncp, &c), "│"));
|
||||||
nccell_release(ncp, &c);
|
nccell_release(ncp, &c);
|
||||||
@ -255,7 +255,7 @@ TEST_CASE("Wide") {
|
|||||||
|
|
||||||
SUBCASE("RenderWides") {
|
SUBCASE("RenderWides") {
|
||||||
CHECK(0 <= ncplane_putstr(n_, "\u5f62\u5168"));
|
CHECK(0 <= ncplane_putstr(n_, "\u5f62\u5168"));
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
ncplane_at_yx_cell(n_, 0, 0, &c);
|
ncplane_at_yx_cell(n_, 0, 0, &c);
|
||||||
CHECK(nccell_double_wide_p(&c));
|
CHECK(nccell_double_wide_p(&c));
|
||||||
ncplane_at_yx_cell(n_, 0, 1, &c);
|
ncplane_at_yx_cell(n_, 0, 1, &c);
|
||||||
@ -290,7 +290,7 @@ TEST_CASE("Wide") {
|
|||||||
// If an ncplane is moved atop the right half of a wide glyph, the entire
|
// If an ncplane is moved atop the right half of a wide glyph, the entire
|
||||||
// glyph should be oblitrated.
|
// glyph should be oblitrated.
|
||||||
SUBCASE("PlaneStompsWideGlyph"){
|
SUBCASE("PlaneStompsWideGlyph"){
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
char* egc;
|
char* egc;
|
||||||
|
|
||||||
// print two wide glyphs on the standard plane
|
// print two wide glyphs on the standard plane
|
||||||
@ -412,7 +412,7 @@ TEST_CASE("Wide") {
|
|||||||
};
|
};
|
||||||
struct ncplane* p = ncplane_create(n_, &nopts);
|
struct ncplane* p = ncplane_create(n_, &nopts);
|
||||||
REQUIRE(nullptr != p);
|
REQUIRE(nullptr != p);
|
||||||
nccell c = CELL_CHAR_INITIALIZER('X');
|
nccell c = NCCELL_CHAR_INITIALIZER('X');
|
||||||
CHECK(0 == ncplane_perimeter(p, &c, &c, &c, &c, &c, &c, 0));
|
CHECK(0 == ncplane_perimeter(p, &c, &c, &c, &c, &c, &c, 0));
|
||||||
ncplane_set_bg_rgb8(n_, 0x20, 0x20, 0x20);
|
ncplane_set_bg_rgb8(n_, 0x20, 0x20, 0x20);
|
||||||
CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "六", nullptr));
|
CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "六", nullptr));
|
||||||
@ -431,7 +431,7 @@ TEST_CASE("Wide") {
|
|||||||
REQUIRE(nullptr != egc);
|
REQUIRE(nullptr != egc);
|
||||||
CHECK(0 == strcmp(" ", egc));
|
CHECK(0 == strcmp(" ", egc));
|
||||||
free(egc);
|
free(egc);
|
||||||
nccell cl = CELL_TRIVIAL_INITIALIZER, cr = CELL_TRIVIAL_INITIALIZER;
|
nccell cl = NCCELL_TRIVIAL_INITIALIZER, cr = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
CHECK(3 == ncplane_at_yx_cell(n_, 1, 1, &cl));
|
CHECK(3 == ncplane_at_yx_cell(n_, 1, 1, &cl));
|
||||||
CHECK(0 == strcmp("六", nccell_extended_gcluster(n_, &cl)));
|
CHECK(0 == strcmp("六", nccell_extended_gcluster(n_, &cl)));
|
||||||
CHECK(0 == ncplane_at_yx_cell(n_, 1, 2, &cr));
|
CHECK(0 == ncplane_at_yx_cell(n_, 1, 2, &cr));
|
||||||
@ -915,7 +915,7 @@ TEST_CASE("Wide") {
|
|||||||
// the NUL backstop for long inlined UTF8).
|
// the NUL backstop for long inlined UTF8).
|
||||||
// U+1F427 PINCHED FINGERS → UTF8(f0 9f a4 8c)
|
// U+1F427 PINCHED FINGERS → UTF8(f0 9f a4 8c)
|
||||||
SUBCASE("ItalicEmoji") {
|
SUBCASE("ItalicEmoji") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_load(n_, &c, "\U0001F427");
|
nccell_load(n_, &c, "\U0001F427");
|
||||||
CHECK(0xa7909ff0 == htole(c.gcluster));
|
CHECK(0xa7909ff0 == htole(c.gcluster));
|
||||||
nccell_on_styles(&c, NCSTYLE_ITALIC);
|
nccell_on_styles(&c, NCSTYLE_ITALIC);
|
||||||
@ -934,7 +934,7 @@ TEST_CASE("Wide") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("StyleMaxEmoji") {
|
SUBCASE("StyleMaxEmoji") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell_load(n_, &c, "\U0001F427");
|
nccell_load(n_, &c, "\U0001F427");
|
||||||
CHECK(0xa7909ff0 == htole(c.gcluster));
|
CHECK(0xa7909ff0 == htole(c.gcluster));
|
||||||
nccell_on_styles(&c, NCSTYLE_MASK);
|
nccell_on_styles(&c, NCSTYLE_MASK);
|
||||||
@ -992,7 +992,7 @@ TEST_CASE("Wide") {
|
|||||||
// fill the screen with un-inlineable EGCs
|
// fill the screen with un-inlineable EGCs
|
||||||
#ifndef __APPLE__ // FIXME
|
#ifndef __APPLE__ // FIXME
|
||||||
SUBCASE("OfflineEGCs") {
|
SUBCASE("OfflineEGCs") {
|
||||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
nccell c = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
const char egc[] = "\U0001F471\u200D\u2640"; // all one EGC
|
const char egc[] = "\U0001F471\u200D\u2640"; // all one EGC
|
||||||
CHECK(0 < nccell_load(n_, &c, egc));
|
CHECK(0 < nccell_load(n_, &c, egc));
|
||||||
ncplane_set_scrolling(n_, true);
|
ncplane_set_scrolling(n_, true);
|
||||||
|
@ -110,8 +110,8 @@ TEST_CASE("ZAxis") {
|
|||||||
// verify that moving one above another, with no other changes, is reflected at
|
// verify that moving one above another, with no other changes, is reflected at
|
||||||
// render time (requires explicit damage maintenance from move functionality).
|
// render time (requires explicit damage maintenance from move functionality).
|
||||||
SUBCASE("ZAxisDamage") {
|
SUBCASE("ZAxisDamage") {
|
||||||
nccell cat = CELL_TRIVIAL_INITIALIZER;
|
nccell cat = NCCELL_TRIVIAL_INITIALIZER;
|
||||||
nccell c = CELL_CHAR_INITIALIZER('x');
|
nccell c = NCCELL_CHAR_INITIALIZER('x');
|
||||||
REQUIRE(!nccell_set_fg_rgb8(&c, 0xff, 0, 0));
|
REQUIRE(!nccell_set_fg_rgb8(&c, 0xff, 0, 0));
|
||||||
REQUIRE(1 == ncplane_putc(n_, &c));
|
REQUIRE(1 == ncplane_putc(n_, &c));
|
||||||
CHECK(!notcurses_render(nc_));
|
CHECK(!notcurses_render(nc_));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user