mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
ncplane_reparent: promote child planes #1078
This commit is contained in:
parent
0485c6f35d
commit
9e460ca1c2
@ -301,7 +301,6 @@ typedef struct ncdirect {
|
|||||||
typedef struct ncpile {
|
typedef struct ncpile {
|
||||||
ncplane* top; // topmost plane, never NULL
|
ncplane* top; // topmost plane, never NULL
|
||||||
ncplane* bottom; // bottommost plane, never NULL
|
ncplane* bottom; // bottommost plane, never NULL
|
||||||
ncplane* root; // first plane of the root set
|
|
||||||
struct notcurses* nc; // notcurses context
|
struct notcurses* nc; // notcurses context
|
||||||
struct ncpile *prev, *next; // circular list
|
struct ncpile *prev, *next; // circular list
|
||||||
} ncpile;
|
} ncpile;
|
||||||
|
@ -303,7 +303,6 @@ make_ncpile(notcurses* nc){
|
|||||||
ret->nc = nc;
|
ret->nc = nc;
|
||||||
ret->top = NULL;
|
ret->top = NULL;
|
||||||
ret->bottom = NULL;
|
ret->bottom = NULL;
|
||||||
ret->root = NULL;
|
|
||||||
if(nc->stdplane){
|
if(nc->stdplane){
|
||||||
ret->prev = ncplane_pile(nc->stdplane)->prev;
|
ret->prev = ncplane_pile(nc->stdplane)->prev;
|
||||||
ncplane_pile(nc->stdplane)->prev->next = ret;
|
ncplane_pile(nc->stdplane)->prev->next = ret;
|
||||||
@ -2160,7 +2159,20 @@ ncplane* ncplane_reparent(ncplane* n, ncplane* newparent){
|
|||||||
if(n->boundto == n && newparent == NULL){
|
if(n->boundto == n && newparent == NULL){
|
||||||
return NULL; // can't make new stack out of a stack's root
|
return NULL; // can't make new stack out of a stack's root
|
||||||
}
|
}
|
||||||
// FIXME take blist, add it to boundto
|
if(n->boundto == n){ // children become new root planes
|
||||||
|
for(ncplane* child = n->blist ; child ; child = child->bnext){
|
||||||
|
child->boundto = child;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(n->blist){
|
||||||
|
if( (n->blist->bnext = n->boundto->blist) ){
|
||||||
|
n->boundto->blist->bprev = &n->blist->bnext;
|
||||||
|
}
|
||||||
|
n->blist->bprev = &n->boundto->blist;
|
||||||
|
n->boundto->blist = n->blist;
|
||||||
|
n->blist = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
return ncplane_reparent_family(n, newparent);
|
return ncplane_reparent_family(n, newparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2186,6 +2198,8 @@ ncplane* ncplane_reparent_family(ncplane* n, ncplane* newparent){
|
|||||||
if(newparent == NULL){
|
if(newparent == NULL){
|
||||||
n->bnext = NULL;
|
n->bnext = NULL;
|
||||||
n->bprev = NULL;
|
n->bprev = NULL;
|
||||||
|
n->boundto = n;
|
||||||
|
// FIXME need new pile
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
if( (n->bnext = newparent->blist) ){
|
if( (n->bnext = newparent->blist) ){
|
||||||
|
Loading…
Reference in New Issue
Block a user