implement child plane scrolling #1883

pull/1937/head
nick black 3 years ago
parent 8db6e3abaa
commit 1f254c47b2
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -383,8 +383,9 @@ other rows are moved up, the last row is cleared, and output begins at the
beginning of the last row. This does not take place until output is generated
(i.e. it is possible to fill a plane when scrolling is enabled).
By default, planes bound to a scrolling plane will scroll along with it. This
can be disabled with the **NCPLANE_OPTION_FIXED** flag.
By default, planes bound to a scrolling plane will scroll along with it, if
they intersect the plane. This can be disabled with the
**NCPLANE_OPTION_FIXED** flag.
## Bitmaps

@ -100,6 +100,7 @@ typedef struct ncplane {
uint16_t stylemask; // same deal as in a cell
int margin_b, margin_r;// bottom and right margins, stored for resize
bool scrolling; // is scrolling enabled? always disabled by default
bool fixedbound; // are we fixed relative to the parent's scrolling?
} ncplane;
// current presentation state of the terminal. it is carried across render

@ -417,6 +417,7 @@ ncplane* ncplane_new_internal(notcurses* nc, ncplane* n,
return NULL;
}
p->scrolling = false;
p->fixedbound = nopts->flags & NCPLANE_OPTION_FIXED;
if(nopts->flags & NCPLANE_OPTION_MARGINALIZED){
p->margin_b = nopts->margin_b;
p->margin_r = nopts->margin_r;
@ -1529,7 +1530,8 @@ nccell_obliterate(ncplane* n, nccell* c){
nccell_init(c);
}
// increment y by 1 and rotate the framebuffer up one line. x moves to 0.
// increment y by 1 and rotate the framebuffer up one line. x moves to 0. any
// non-fixed bound planes move up 1 line if they intersect the plane.
void scroll_down(ncplane* n){
//fprintf(stderr, "pre-scroll: %d/%d %d/%d log: %d scrolling: %u\n", n->y, n->x, n->leny, n->lenx, n->logrow, n->scrolling);
n->x = 0;
@ -1546,6 +1548,12 @@ void scroll_down(ncplane* n){
}else{
++n->y;
}
for(struct ncplane* c = n->blist ; c ; c = c->bnext){
if(!c->fixedbound){
// FIXME ought only be performed if we intersect the parent plane
ncplane_moverel(c, -1, 0);
}
}
}
int nccell_width(const ncplane* n __attribute__ ((unused)), const nccell* c){

Loading…
Cancel
Save