mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
[putstr] take size_t* for sbytes, not int* #2331
This commit is contained in:
parent
9b4fb10d6a
commit
5ff59ce421
3
NEWS.md
3
NEWS.md
@ -2,7 +2,7 @@ This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 3.0.0 (not yet released) **"In the A"**
|
||||
* Made the ABI changes that have been planned/collected during 2.x
|
||||
* Made the ABI/API changes that have been planned/collected during 2.x
|
||||
development. This primarily involved removing deprecated functions,
|
||||
and making some `static inline` (and thus no longer linkable symbols).
|
||||
There have been a few small renamings (i.e. `ncplane_pixelgeom()` to
|
||||
@ -34,7 +34,6 @@ rearrangements of Notcurses.
|
||||
`ncqprefix()`, `ncbprefix()`, and `nciprefix()`, respectively.
|
||||
All related constants have been prefixed with `NC`, and the old
|
||||
definitions will be removed for abi3.
|
||||
The former forms have been deprecated, and will be removed in abi3.
|
||||
* `notcurses_mice_enable()` and `notcurses_mouse_disable()` replace
|
||||
`notcurses_mouse_enable()` and `notcurses_mouse_disable()`, which
|
||||
have been deprecated, and will be removed in ABI3.
|
||||
|
@ -526,7 +526,7 @@ namespace ncpp
|
||||
return error_guard<int> (ncplane_putchar_yx (plane, y, x, c), -1);
|
||||
}
|
||||
|
||||
int putc (const char *gclust, int *sbytes = nullptr, bool retain_styling = false) const NOEXCEPT_MAYBE
|
||||
int putc (const char *gclust, size_t *sbytes = nullptr, bool retain_styling = false) const NOEXCEPT_MAYBE
|
||||
{
|
||||
int ret;
|
||||
if (retain_styling) {
|
||||
@ -538,12 +538,12 @@ namespace ncpp
|
||||
return error_guard<int> (ret, -1);
|
||||
}
|
||||
|
||||
int putc (int y, int x, const char *gclust, int *sbytes = nullptr) const NOEXCEPT_MAYBE
|
||||
int putc (int y, int x, const char *gclust, size_t *sbytes = nullptr) const NOEXCEPT_MAYBE
|
||||
{
|
||||
return error_guard<int> (ncplane_putegc_yx (plane, y, x, gclust, sbytes), -1);
|
||||
}
|
||||
|
||||
int putc (const wchar_t *gclust, int *sbytes = nullptr, bool retain_styling = false) const NOEXCEPT_MAYBE
|
||||
int putc (const wchar_t *gclust, size_t *sbytes = nullptr, bool retain_styling = false) const NOEXCEPT_MAYBE
|
||||
{
|
||||
int ret;
|
||||
if (retain_styling) {
|
||||
@ -555,7 +555,7 @@ namespace ncpp
|
||||
return error_guard<int> (ret, -1);
|
||||
}
|
||||
|
||||
int putc (int y, int x, const wchar_t *gclust, int *sbytes = nullptr) const NOEXCEPT_MAYBE
|
||||
int putc (int y, int x, const wchar_t *gclust, size_t *sbytes = nullptr) const NOEXCEPT_MAYBE
|
||||
{
|
||||
return error_guard<int> (ncplane_putwegc_yx (plane, y, x, gclust, sbytes), -1);
|
||||
}
|
||||
|
@ -1956,17 +1956,18 @@ API int ncplane_putchar_stained(struct ncplane* n, char c);
|
||||
// plane). On success, returns the number of columns the cursor was advanced.
|
||||
// On failure, -1 is returned. The number of bytes converted from gclust is
|
||||
// written to 'sbytes' if non-NULL.
|
||||
API int ncplane_putegc_yx(struct ncplane* n, int y, int x, const char* gclust, int* sbytes);
|
||||
API int ncplane_putegc_yx(struct ncplane* n, int y, int x, const char* gclust,
|
||||
size_t* sbytes);
|
||||
|
||||
// Call ncplane_putegc_yx() at the current cursor location.
|
||||
static inline int
|
||||
ncplane_putegc(struct ncplane* n, const char* gclust, int* sbytes){
|
||||
ncplane_putegc(struct ncplane* n, const char* gclust, size_t* sbytes){
|
||||
return ncplane_putegc_yx(n, -1, -1, gclust, sbytes);
|
||||
}
|
||||
|
||||
// Replace the EGC underneath us, but retain the styling. The current styling
|
||||
// of the plane will not be changed.
|
||||
API int ncplane_putegc_stained(struct ncplane* n, const char* gclust, int* sbytes);
|
||||
API int ncplane_putegc_stained(struct ncplane* n, const char* gclust, size_t* sbytes);
|
||||
|
||||
// 0x0--0x10ffff can be UTF-8-encoded with only 4 bytes
|
||||
#define WCHAR_MAX_UTF8BYTES 4
|
||||
@ -1995,7 +1996,7 @@ ncwcsrtombs(const wchar_t* src){
|
||||
|
||||
// ncplane_putegc(), but following a conversion from wchar_t to UTF-8 multibyte.
|
||||
static inline int
|
||||
ncplane_putwegc(struct ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
ncplane_putwegc(struct ncplane* n, const wchar_t* gclust, size_t* sbytes){
|
||||
char* mbstr = ncwcsrtombs(gclust);
|
||||
if(mbstr == NULL){
|
||||
return -1;
|
||||
@ -2008,7 +2009,7 @@ ncplane_putwegc(struct ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
// Call ncplane_putwegc() after successfully moving to y, x.
|
||||
static inline int
|
||||
ncplane_putwegc_yx(struct ncplane* n, int y, int x, const wchar_t* gclust,
|
||||
int* sbytes){
|
||||
size_t* sbytes){
|
||||
if(ncplane_cursor_move_yx(n, y, x)){
|
||||
return -1;
|
||||
}
|
||||
@ -2017,7 +2018,7 @@ ncplane_putwegc_yx(struct ncplane* n, int y, int x, const wchar_t* gclust,
|
||||
|
||||
// Replace the EGC underneath us, but retain the styling. The current styling
|
||||
// of the plane will not be changed.
|
||||
API int ncplane_putwegc_stained(struct ncplane* n, const wchar_t* gclust, int* sbytes);
|
||||
API int ncplane_putwegc_stained(struct ncplane* n, const wchar_t* gclust, size_t* sbytes);
|
||||
|
||||
// Write a series of EGCs to the current location, using the current style.
|
||||
// They will be interpreted as a series of columns (according to the definition
|
||||
@ -2029,7 +2030,7 @@ static inline int
|
||||
ncplane_putstr_yx(struct ncplane* n, int y, int x, const char* gclusters){
|
||||
int ret = 0;
|
||||
while(*gclusters){
|
||||
int wcs;
|
||||
size_t wcs;
|
||||
int cols = ncplane_putegc_yx(n, y, x, gclusters, &wcs);
|
||||
//fprintf(stderr, "wrote %.*s %d cols %d bytes now at %d/%d\n", wcs, gclusters, cols, wcs, n->y, n->x);
|
||||
if(cols < 0){
|
||||
@ -2071,7 +2072,7 @@ static inline int
|
||||
ncplane_putstr_stained(struct ncplane* n, const char* gclusters){
|
||||
int ret = 0;
|
||||
while(*gclusters){
|
||||
int wcs;
|
||||
size_t wcs;
|
||||
int cols = ncplane_putegc_stained(n, gclusters, &wcs);
|
||||
if(cols < 0){
|
||||
return -ret;
|
||||
@ -2100,7 +2101,7 @@ ncplane_putnstr_yx(struct ncplane* n, int y, int x, size_t s, const char* gclust
|
||||
int offset = 0;
|
||||
//fprintf(stderr, "PUT %zu at %d/%d [%.*s]\n", s, y, x, (int)s, gclusters);
|
||||
while((size_t)offset < s && gclusters[offset]){
|
||||
int wcs;
|
||||
size_t wcs;
|
||||
int cols = ncplane_putegc_yx(n, y, x, gclusters + offset, &wcs);
|
||||
if(cols < 0){
|
||||
return -ret;
|
||||
|
@ -170,7 +170,7 @@ drawcycles(struct ncplane* std, struct ncprogbar* left, struct ncprogbar* right,
|
||||
free(ncplane_at_yx(std, endy, endx, NULL, channels));
|
||||
ncplane_set_bg_rgb(std, ncchannels_bg_rgb(*channels));
|
||||
ncplane_set_fg_rgb(std, 0xffffff);
|
||||
int sbytes;
|
||||
size_t sbytes;
|
||||
if(ncplane_putegc_yx(std, endy, endx, cstr + offset, &sbytes) < 0){
|
||||
return -1;
|
||||
}
|
||||
|
@ -125,7 +125,6 @@ draw_eagle(struct ncplane* n, const char* sprite){
|
||||
ncplane_set_base_cell(n, &bgc);
|
||||
nccell_release(n, &bgc);
|
||||
size_t s;
|
||||
int sbytes;
|
||||
for(s = 0 ; sprite[s] ; ++s){
|
||||
switch(sprite[s]){
|
||||
case '0':
|
||||
@ -146,7 +145,7 @@ draw_eagle(struct ncplane* n, const char* sprite){
|
||||
b = ncplane_bg_rgb(n);
|
||||
ncplane_set_fg_rgb(n, b);
|
||||
ncplane_set_bg_rgb(n, f);
|
||||
if(ncplane_putegc_yx(n, s / 16, s % 16, " ", &sbytes) != 1){
|
||||
if(ncplane_putegc_yx(n, s / 16, s % 16, " ", NULL) != 1){
|
||||
return -1;
|
||||
}
|
||||
ncplane_set_fg_rgb(n, f);
|
||||
|
@ -116,7 +116,6 @@ draw_luigi(struct ncplane* n, const char* sprite){
|
||||
ncchannels_set_bg_alpha(&channels, NCALPHA_TRANSPARENT);
|
||||
ncplane_set_base(n, "", 0, channels);
|
||||
size_t s;
|
||||
int sbytes;
|
||||
// optimization so we can elide more color changes, see README's "#perf"
|
||||
ncplane_set_bg_rgb8(n, 0x00, 0x00, 0x00);
|
||||
for(s = 0 ; sprite[s] ; ++s){
|
||||
@ -134,7 +133,7 @@ draw_luigi(struct ncplane* n, const char* sprite){
|
||||
break;
|
||||
}
|
||||
if(sprite[s] != '0'){
|
||||
if(ncplane_putegc_yx(n, s / 16, s % 16, " ", &sbytes) != 1){
|
||||
if(ncplane_putegc_yx(n, s / 16, s % 16, " ", NULL) != 1){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -507,15 +507,11 @@ int witherworm_demo(struct notcurses* nc){
|
||||
idx += eaten;
|
||||
continue;
|
||||
}
|
||||
int ulen = 0;
|
||||
size_t ulen = 0;
|
||||
int r;
|
||||
if(wcwidth(wcs) <= (int)(maxx - x)){
|
||||
if((r = ncplane_putegc(n, &(*s)[idx], &ulen)) <= 0){
|
||||
if(ulen < 0){
|
||||
return -1;
|
||||
}else if(ulen == 0){
|
||||
break; // FIXME work around missing unicode
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
if((r = ncplane_putchar(n, '#')) < 1){
|
||||
|
@ -139,7 +139,7 @@ emoji_viz(struct ncplane* n){
|
||||
"\U0001f93d\U0001f3fc\u200d\u2640\ufe0f" // type-3 woman playing water polo
|
||||
;
|
||||
ncplane_set_bg_rgb(n, 0);
|
||||
int bytes;
|
||||
size_t bytes;
|
||||
for(const char* e = emoji ; *e ; e += bytes){
|
||||
if(ncplane_putegc(n, e, &bytes) < 0){
|
||||
if(ncplane_putchar(n, ' ') < 0){
|
||||
|
@ -91,10 +91,9 @@ notcurses_stop_minimal(void* vnc){
|
||||
if(cnorm && fbuf_emit(f, cnorm)){
|
||||
ret = -1;
|
||||
}
|
||||
if(blocking_write(fileno(nc->ttyfp), f->buf, f->used)){
|
||||
if(fbuf_flush(f, nc->ttyfp)){
|
||||
ret = -1;
|
||||
}
|
||||
fbuf_reset(f);
|
||||
if(nc->tcache.ttyfd >= 0){
|
||||
ret |= notcurses_mice_disable(nc);
|
||||
if(nc->tcache.tpreserved){
|
||||
@ -1684,7 +1683,7 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const nccell* c){
|
||||
return ncplane_put(n, y, x, egc, cols, c->stylemask, c->channels, strlen(egc));
|
||||
}
|
||||
|
||||
int ncplane_putegc_yx(ncplane* n, int y, int x, const char* gclust, int* sbytes){
|
||||
int ncplane_putegc_yx(ncplane* n, int y, int x, const char* gclust, size_t* sbytes){
|
||||
int cols;
|
||||
int bytes = utf8_egc_len(gclust, &cols);
|
||||
if(bytes < 0){
|
||||
@ -1709,7 +1708,7 @@ int ncplane_putchar_stained(ncplane* n, char c){
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ncplane_putwegc_stained(ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
int ncplane_putwegc_stained(ncplane* n, const wchar_t* gclust, size_t* sbytes){
|
||||
uint64_t channels = n->channels;
|
||||
uint16_t stylemask = n->stylemask;
|
||||
const nccell* targ = &n->fb[nfbcellidx(n, n->y, n->x)];
|
||||
@ -1721,7 +1720,7 @@ int ncplane_putwegc_stained(ncplane* n, const wchar_t* gclust, int* sbytes){
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ncplane_putegc_stained(ncplane* n, const char* gclust, int* sbytes){
|
||||
int ncplane_putegc_stained(ncplane* n, const char* gclust, size_t* sbytes){
|
||||
uint64_t channels = n->channels;
|
||||
uint16_t stylemask = n->stylemask;
|
||||
const nccell* targ = &n->fb[nfbcellidx(n, n->y, n->x)];
|
||||
|
17
src/poc/cli.c
Normal file
17
src/poc/cli.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <notcurses/notcurses.h>
|
||||
|
||||
int main(void){
|
||||
struct notcurses_options opts = {
|
||||
.flags = NCOPTION_NO_ALTERNATE_SCREEN |
|
||||
NCOPTION_PRESERVE_CURSOR |
|
||||
NCOPTION_NO_CLEAR_BITMAPS |
|
||||
NCOPTION_DRAIN_INPUT |
|
||||
NCOPTION_SUPPRESS_BANNERS,
|
||||
};
|
||||
struct notcurses* nc = notcurses_init(&opts, NULL);
|
||||
if(nc == NULL){
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
notcurses_stop(nc);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -30,7 +30,7 @@ int main(void){
|
||||
const char *b = brew;
|
||||
for(unsigned y = dimy / 2 + 2 ; y < dimy ; ++y){
|
||||
for(unsigned x = 0 ; x < dimx ; ++x){
|
||||
int bytes;
|
||||
size_t bytes;
|
||||
if(ncplane_putegc_yx(n, y, x, b, &bytes) <= 0){
|
||||
break;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ TEST_CASE("Fills") {
|
||||
CHECK(0 < ncplane_putc_yx(pfn, 0, 0, &c));
|
||||
CHECK(0 < nccell_load(pfn, &c, "/"));
|
||||
CHECK(0 < ncplane_polyfill_yx(pfn, 0, 0, &c));
|
||||
char* ncpc = ncplane_at_yx(pfn, 0, 0, NULL, NULL);
|
||||
char* ncpc = ncplane_at_yx(pfn, 0, 0, nullptr, nullptr);
|
||||
CHECK(0 == strcmp(ncpc, "/"));
|
||||
free(ncpc);
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
@ -241,11 +241,10 @@ TEST_CASE("Fills") {
|
||||
}
|
||||
|
||||
SUBCASE("Format") {
|
||||
int sbytes;
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||
CHECK(1 == ncplane_putegc(n_, "A", &sbytes));
|
||||
CHECK(1 == ncplane_putegc(n_, "A", nullptr));
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x888888));
|
||||
CHECK(1 == ncplane_putegc(n_, "B", &sbytes));
|
||||
CHECK(1 == ncplane_putegc(n_, "B", nullptr));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
// attr should change, but not the EGC/color
|
||||
CHECK(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||
@ -259,11 +258,10 @@ TEST_CASE("Fills") {
|
||||
}
|
||||
|
||||
SUBCASE("Stain") {
|
||||
int sbytes;
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||
for(unsigned y = 0 ; y < 8 ; ++y){
|
||||
for(unsigned x = 0 ; x < 8 ; ++x){
|
||||
CHECK(1 == ncplane_putegc_yx(n_, y, x, "A", &sbytes));
|
||||
CHECK(1 == ncplane_putegc_yx(n_, y, x, "A", nullptr));
|
||||
}
|
||||
}
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
@ -286,9 +284,8 @@ TEST_CASE("Fills") {
|
||||
|
||||
// test the single-cell (1x1) special case
|
||||
SUBCASE("GradientSingleCell") {
|
||||
int sbytes;
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||
CHECK(1 == ncplane_putegc_yx(n_, 0, 0, "A", &sbytes));
|
||||
CHECK(1 == ncplane_putegc_yx(n_, 0, 0, "A", nullptr));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
uint64_t channels = 0;
|
||||
ncchannels_set_fg_rgb8(&channels, 0x88, 0x99, 0x77);
|
||||
@ -304,9 +301,8 @@ TEST_CASE("Fills") {
|
||||
|
||||
// 1d gradients over multiple cells
|
||||
SUBCASE("Gradient1D") {
|
||||
int sbytes;
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||
CHECK(1 == ncplane_putegc_yx(n_, 0, 0, "A", &sbytes));
|
||||
CHECK(1 == ncplane_putegc_yx(n_, 0, 0, "A", nullptr));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||
uint64_t chan1 = 0, chan2 = 0;
|
||||
|
@ -138,8 +138,7 @@ TEST_CASE("Plane") {
|
||||
// Verify we can emit a wchar_t, and it advances the cursor
|
||||
SUBCASE("EmitWcharT") {
|
||||
const wchar_t* w = L"✔";
|
||||
int sbytes = 0;
|
||||
CHECK(0 < ncplane_putwegc(n_, w, &sbytes));
|
||||
CHECK(0 < ncplane_putwegc(n_, w, nullptr));
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
CHECK(0 == y);
|
||||
@ -761,8 +760,7 @@ TEST_CASE("Plane") {
|
||||
SUBCASE("RightToLeft") {
|
||||
// give us some room on both sides
|
||||
CHECK(0 == ncplane_cursor_move_yx(n_, 1, 5));
|
||||
int sbytes = -1;
|
||||
CHECK(0 < ncplane_putegc(n_, "־", &sbytes));
|
||||
CHECK(0 < ncplane_putegc(n_, "־", nullptr));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
CHECK(0 == ncplane_cursor_move_yx(n_, 3, 5));
|
||||
CHECK(0 < ncplane_putstr(n_, "I write English + מילים בעברית together."));
|
||||
@ -833,17 +831,16 @@ TEST_CASE("Plane") {
|
||||
|
||||
SUBCASE("EGCStained") {
|
||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
||||
int sbytes;
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x444444));
|
||||
CHECK(1 == ncplane_putegc(n_, "A", &sbytes));
|
||||
CHECK(1 == ncplane_putegc(n_, "A", nullptr));
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x888888));
|
||||
CHECK(1 == ncplane_putegc(n_, "B", &sbytes));
|
||||
CHECK(1 == ncplane_putegc(n_, "B", nullptr));
|
||||
CHECK(0 == ncplane_cursor_move_yx(n_, 0, 0));
|
||||
CHECK(0 == notcurses_render(nc_));
|
||||
// EGC should change, but not the color
|
||||
CHECK(0 == ncplane_set_fg_rgb(n_, 0x222222));
|
||||
CHECK(1 == ncplane_putegc_stained(n_, "C", &sbytes));
|
||||
CHECK(1 == ncplane_putegc_stained(n_, "D", &sbytes));
|
||||
CHECK(1 == ncplane_putegc_stained(n_, "C", nullptr));
|
||||
CHECK(1 == ncplane_putegc_stained(n_, "D", nullptr));
|
||||
uint64_t channels = 0;
|
||||
CHECK(1 == ncplane_at_yx_cell(n_, 0, 0, &c));
|
||||
CHECK(cell_simple_p(&c));
|
||||
|
@ -19,8 +19,7 @@ TEST_CASE("Wide") {
|
||||
// Verify we can emit a wide character, and it advances the cursor by 2
|
||||
SUBCASE("EmitWideAsian") {
|
||||
const char* w = "\u5168";
|
||||
int sbytes = 0;
|
||||
CHECK(0 < ncplane_putegc(n_, w, &sbytes));
|
||||
CHECK(0 < ncplane_putegc(n_, w, nullptr));
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
CHECK(0 == y);
|
||||
@ -31,16 +30,15 @@ TEST_CASE("Wide") {
|
||||
// Verify a wide character is rejected with cursor on the last column
|
||||
SUBCASE("RejectWideAsian") {
|
||||
const char* w = "\u5168";
|
||||
int sbytes = 0;
|
||||
unsigned dimx;
|
||||
ncplane_dim_yx(n_, nullptr, &dimx);
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, dimx - 3, w, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, dimx - 3, w, nullptr));
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
CHECK(0 == y);
|
||||
CHECK(dimx - 1 == x);
|
||||
// now it ought be rejected
|
||||
CHECK(0 > ncplane_putegc(n_, w, &sbytes));
|
||||
CHECK(0 > ncplane_putegc(n_, w, nullptr));
|
||||
// cursor ought remain where it was
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
CHECK(0 == y);
|
||||
@ -51,11 +49,10 @@ TEST_CASE("Wide") {
|
||||
// Verify a wide character is rejected when placed on the last column
|
||||
SUBCASE("RejectWideAsianPlaced") {
|
||||
const char* w = "\u5168";
|
||||
int sbytes = 0;
|
||||
unsigned dimx;
|
||||
ncplane_dim_yx(n_, nullptr, &dimx);
|
||||
// now it ought be rejected
|
||||
CHECK(0 > ncplane_putegc_yx(n_, 0, dimx - 1, w, &sbytes));
|
||||
CHECK(0 > ncplane_putegc_yx(n_, 0, dimx - 1, w, nullptr));
|
||||
// cursor ought remain where it was
|
||||
unsigned y, x;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
@ -113,14 +110,13 @@ TEST_CASE("Wide") {
|
||||
const char* w = FROG;
|
||||
const char* wbashed = SCORPION;
|
||||
const char bashed = 'X';
|
||||
int sbytes = 0;
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 1, wbashed, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 1, wbashed, nullptr));
|
||||
CHECK(0 < ncplane_putchar_yx(n_, 1, 1, bashed));
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
CHECK(1 == y);
|
||||
CHECK(2 == x);
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, w, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, w, nullptr));
|
||||
nccell c = CELL_TRIVIAL_INITIALIZER;
|
||||
CHECK(0 < nccell_load(n_, &c, w));
|
||||
CHECK(0 < ncplane_putc_yx(n_, 1, 0, &c));
|
||||
@ -143,10 +139,9 @@ TEST_CASE("Wide") {
|
||||
SUBCASE("WideCharAnnihilatesWideLeft") {
|
||||
const char* w = SNAKE;
|
||||
const char* wbashed = SCORPION;
|
||||
int sbytes = 0;
|
||||
int cols1 = ncplane_putegc_yx(n_, 0, 0, wbashed, &sbytes);
|
||||
int cols1 = ncplane_putegc_yx(n_, 0, 0, wbashed, nullptr);
|
||||
CHECK(0 < cols1);
|
||||
int cols2 = ncplane_putegc_yx(n_, 0, 1, w, &sbytes);
|
||||
int cols2 = ncplane_putegc_yx(n_, 0, 1, w, nullptr);
|
||||
CHECK(0 < cols2);
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
@ -170,9 +165,8 @@ TEST_CASE("Wide") {
|
||||
const char* cc = "X";
|
||||
const char* wbashedl = SNAKE;
|
||||
const char* wbashedr = SCORPION;
|
||||
int sbytes = 0;
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, wbashedl, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 2, wbashedr, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, wbashedl, nullptr));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 2, wbashedr, nullptr));
|
||||
CHECK(1 == ncplane_putchar_yx(n_, 0, 1, *cc));
|
||||
CHECK(1 == ncplane_putchar_yx(n_, 0, 2, *cc));
|
||||
unsigned x, y;
|
||||
@ -201,9 +195,8 @@ TEST_CASE("Wide") {
|
||||
const char* cc = "X";
|
||||
const char* wsafel = SNAKE;
|
||||
const char* wsafer = SCORPION;
|
||||
int sbytes = 0;
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, wsafel, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 3, wsafer, &sbytes));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 0, wsafel, nullptr));
|
||||
CHECK(0 < ncplane_putegc_yx(n_, 0, 3, wsafer, nullptr));
|
||||
CHECK(1 == ncplane_putchar_yx(n_, 0, 2, *cc));
|
||||
unsigned x, y;
|
||||
ncplane_cursor_yx(n_, &y, &x);
|
||||
@ -422,8 +415,7 @@ TEST_CASE("Wide") {
|
||||
nccell c = CELL_CHAR_INITIALIZER('X');
|
||||
CHECK(0 == ncplane_perimeter(p, &c, &c, &c, &c, &c, &c, 0));
|
||||
ncplane_set_bg_rgb8(n_, 0x20, 0x20, 0x20);
|
||||
int sbytes;
|
||||
CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "六", &sbytes));
|
||||
CHECK(2 == ncplane_putegc_yx(n_, 1, 1, "六", nullptr));
|
||||
uint64_t channels = 0;
|
||||
ncchannels_set_bg_alpha(&channels, NCALPHA_BLEND);
|
||||
ncchannels_set_bg_rgb8(&channels, 0x80, 0xf0, 0x10);
|
||||
|
Loading…
x
Reference in New Issue
Block a user