mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
simplify wide handling in putc_yx #362
This commit is contained in:
parent
e6a80ab98d
commit
b0aa6b9a7f
@ -1239,14 +1239,8 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const cell* c){
|
||||
return -1;
|
||||
}
|
||||
int cols = 1;
|
||||
if(wide){
|
||||
++cols;
|
||||
cell* rtarg = &n->fb[nfbcellidx(n, n->y, n->x + 1)];
|
||||
cell_release(n, rtarg);
|
||||
cell_init(rtarg);
|
||||
cell_set_wide(rtarg);
|
||||
}
|
||||
if(wide){ // must set our right wide, and check for further damage
|
||||
++cols;
|
||||
if(n->x < n->lenx - 1){ // check to our right
|
||||
cell* candidate = &n->fb[nfbcellidx(n, n->y, n->x + 1)];
|
||||
if(n->x < n->lenx - 2){
|
||||
@ -1254,8 +1248,8 @@ int ncplane_putc_yx(ncplane* n, int y, int x, const cell* c){
|
||||
cell_obliterate(n, &n->fb[nfbcellidx(n, n->y, n->x + 2)]);
|
||||
}
|
||||
}
|
||||
cell_obliterate(n, candidate);
|
||||
cell_set_wide(candidate);
|
||||
cell_release(n, candidate);
|
||||
}
|
||||
}
|
||||
n->x += cols;
|
||||
|
@ -103,7 +103,7 @@ TEST_CASE("RenderTest") {
|
||||
// should be nothing, having been stomped
|
||||
egc = notcurses_at_yx(nc_, 0, 0, &c.attrword, &c.channels);
|
||||
REQUIRE(egc);
|
||||
CHECK(0 == strcmp("", egc));
|
||||
CHECK(0 == strcmp(" ", egc));
|
||||
free(egc);
|
||||
cell_init(&c);
|
||||
// should be character from higher plane
|
||||
@ -122,7 +122,7 @@ TEST_CASE("RenderTest") {
|
||||
// should be nothing, having been stomped
|
||||
egc = notcurses_at_yx(nc_, 0, 3, &c.attrword, &c.channels);
|
||||
REQUIRE(egc);
|
||||
CHECK(0 == strcmp("", egc));
|
||||
CHECK(0 == strcmp(" ", egc));
|
||||
free(egc);
|
||||
cell_init(&c);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user