mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
ncneofetch: work no matter y offset, done! #750
This commit is contained in:
parent
ef9e50be33
commit
31c584e2e6
@ -273,18 +273,27 @@ drawpalette(struct ncdirect* nc){
|
|||||||
static struct notcurses*
|
static struct notcurses*
|
||||||
place_infoplane(struct ncdirect* ncd, int planeheight){
|
place_infoplane(struct ncdirect* ncd, int planeheight){
|
||||||
const int dimy = ncdirect_dim_y(ncd);
|
const int dimy = ncdirect_dim_y(ncd);
|
||||||
|
int cury;
|
||||||
|
if(ncdirect_cursor_yx(ncd, &cury, NULL)){
|
||||||
|
ncdirect_stop(ncd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
struct notcurses_options opts = {
|
struct notcurses_options opts = {
|
||||||
.flags = NCOPTION_SUPPRESS_BANNERS | NCOPTION_INHIBIT_SETLOCALE
|
.flags = NCOPTION_SUPPRESS_BANNERS | NCOPTION_INHIBIT_SETLOCALE
|
||||||
| NCOPTION_NO_ALTERNATE_SCREEN,
|
| NCOPTION_NO_ALTERNATE_SCREEN,
|
||||||
.margin_t = dimy - planeheight,
|
.margin_t = cury,
|
||||||
|
.margin_b = dimy - (cury + planeheight),
|
||||||
};
|
};
|
||||||
if(ncdirect_stop(ncd)){
|
// if we're at the bottom of the screen, we need scroll it up, and adjust
|
||||||
return NULL;
|
while(opts.margin_b < 0){
|
||||||
}
|
|
||||||
for(int i = 0 ; i < planeheight ; ++i){
|
|
||||||
if(putchar('\n') == EOF){
|
if(putchar('\n') == EOF){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
++opts.margin_b;
|
||||||
|
--opts.margin_t;
|
||||||
|
}
|
||||||
|
if(ncdirect_stop(ncd)){
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
return notcurses_init(&opts, NULL);
|
return notcurses_init(&opts, NULL);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np){
|
|||||||
// not have it when using 2x1 (we insert blank lines otherwise). don't paper
|
// not have it when using 2x1 (we insert blank lines otherwise). don't paper
|
||||||
// over it with a conditional, but instead get to the bottom of this FIXME.
|
// over it with a conditional, but instead get to the bottom of this FIXME.
|
||||||
ncdirect_cursor_left(n, dimx);
|
ncdirect_cursor_left(n, dimx);
|
||||||
ncdirect_cursor_down(n, 1);
|
//ncdirect_cursor_down(n, 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user