diff --git a/src/lib/internal.h b/src/lib/internal.h index 383d66c76..030d9970a 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -591,15 +591,17 @@ cell_debug(const egcpool* p, const cell* c){ } static inline void -plane_debug(const ncplane* n){ +plane_debug(const ncplane* n, bool details){ int dimy, dimx; ncplane_dim_yx(n, &dimy, &dimx); fprintf(stderr, "p: %p dim: %d/%d poolsize: %d\n", n, dimy, dimx, n->pool.poolsize); - for(int y = 0 ; y < 1 ; ++y){ - for(int x = 0 ; x < 10 ; ++x){ - const cell* c = &n->fb[fbcellidx(y, dimx, x)]; - fprintf(stderr, "[%03d/%03d] ", y, x); - cell_debug(&n->pool, c); + if(details){ + for(int y = 0 ; y < 1 ; ++y){ + for(int x = 0 ; x < 10 ; ++x){ + const cell* c = &n->fb[fbcellidx(y, dimx, x)]; + fprintf(stderr, "[%03d/%03d] ", y, x); + cell_debug(&n->pool, c); + } } } } diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 56a3f2572..bd73f4a7f 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1052,11 +1052,11 @@ uint32_t ncplane_attr(const ncplane* n){ return n->attrword; } -void ncplane_set_fg_default(struct ncplane* n){ +void ncplane_set_fg_default(ncplane* n){ channels_set_fg_default(&n->channels); } -void ncplane_set_bg_default(struct ncplane* n){ +void ncplane_set_bg_default(ncplane* n){ channels_set_bg_default(&n->channels); } @@ -1128,7 +1128,7 @@ int ncplane_base(ncplane* ncp, cell* c){ return cell_duplicate(ncp, c, &ncp->basecell); } -const char* cell_extended_gcluster(const struct ncplane* n, const cell* c){ +const char* cell_extended_gcluster(const ncplane* n, const cell* c){ return extended_gcluster(n, c); } @@ -1263,7 +1263,7 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const cell* c){ return cols; } -int ncplane_putegc_yx(struct ncplane* n, int y, int x, const char* gclust, int* sbytes){ +int ncplane_putegc_yx(ncplane* n, int y, int x, const char* gclust, int* sbytes){ cell c = CELL_TRIVIAL_INITIALIZER; int primed = cell_prime(n, &c, gclust, n->attrword, n->channels); if(sbytes){ diff --git a/tests/egcpool.cpp b/tests/egcpool.cpp index 619057edc..f94e8ab29 100644 --- a/tests/egcpool.cpp +++ b/tests/egcpool.cpp @@ -205,6 +205,31 @@ TEST_CASE("EGCpool") { CHECK(candidates.size() / 13 > no); } + // ensure that a hard error comes up when we fill the EGCpool + SUBCASE("ExhaustPool") { + wchar_t wcs = 0x4e00; + uint64_t total = 0; + while(true){ + char mb[MB_CUR_MAX + 1]; + auto r = wctomb(mb, wcs); + CHECK(0 < r); + REQUIRE(sizeof(mb) >= r); + mb[r] = '\0'; + int loc = egcpool_stash(&pool_, mb, r); + if(loc < 0){ + break; + } + REQUIRE(loc == total); + total += r + 1; + CHECK(egcpool_check_validity(&pool_, loc)); + CHECK((1u << 25) > loc); + if(++wcs == 0x9fa5){ + wcs = 0x4e00; + } + } + CHECK((1u << 25) <= total); + } + // common cleanup egcpool_dump(&pool_); diff --git a/tests/scrolling.cpp b/tests/scrolling.cpp index 9f685ced3..62c324365 100644 --- a/tests/scrolling.cpp +++ b/tests/scrolling.cpp @@ -180,8 +180,8 @@ TEST_CASE("Scrolling") { SUBCASE("XYPostScroll") { const char* out = "0123456789012345678901234567890123456789"; const char* onext = "ABCDEFGHIJ"; - const char* next2 = "KLMNOPQRST"; - const char* next3 = "UVWXYZ"; + //const char* next2 = "KLMNOPQRST"; + //const char* next3 = "UVWXYZ"; CHECK(0 == notcurses_render(nc_)); struct ncplane* n = ncplane_new(nc_, 2, 20, 1, 1, nullptr); REQUIRE(n);