mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
ncplane_dup: don't dup sprixcells #1654
This commit is contained in:
parent
8bd73378cf
commit
ce2f2c6509
@ -555,11 +555,20 @@ ncplane* ncplane_dup(const ncplane* n, void* opaque){
|
||||
.flags = 0,
|
||||
};
|
||||
ncplane* newn = ncplane_create(n->boundto, &nopts);
|
||||
if(newn){
|
||||
if(newn == NULL){
|
||||
return NULL;
|
||||
}
|
||||
// we don't duplicate sprites...though i'm unsure why not
|
||||
size_t fbsize = sizeof(*n->fb) * dimx * dimy;
|
||||
if(n->sprite == NULL){
|
||||
if(egcpool_dup(&newn->pool, &n->pool)){
|
||||
ncplane_destroy(newn);
|
||||
return NULL;
|
||||
}
|
||||
memmove(newn->fb, n->fb, fbsize);
|
||||
}else{
|
||||
memset(newn->fb, 0, fbsize);
|
||||
}
|
||||
if(ncplane_cursor_move_yx(newn, n->y, n->x) < 0){
|
||||
ncplane_destroy(newn);
|
||||
return NULL;
|
||||
@ -567,11 +576,8 @@ ncplane* ncplane_dup(const ncplane* n, void* opaque){
|
||||
newn->halign = n->halign;
|
||||
newn->stylemask = ncplane_styles(n);
|
||||
newn->channels = ncplane_channels(n);
|
||||
memmove(newn->fb, n->fb, sizeof(*n->fb) * dimx * dimy);
|
||||
// we dupd the egcpool, so just dup the goffset
|
||||
newn->basecell = n->basecell;
|
||||
}
|
||||
}
|
||||
return newn;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user