adjust ncplane_yx() for margins

This commit is contained in:
nick black 2020-03-13 06:53:52 -04:00
parent c056a0a026
commit d5d827f38e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 5 additions and 4 deletions

View File

@ -99,6 +99,7 @@ int intro(struct notcurses* nc){
return -1; return -1;
} }
ncplane_styles_off(ncp, NCSTYLE_ITALIC); ncplane_styles_off(ncp, NCSTYLE_ITALIC);
// FIXME don't blow away the background color from the gradient. make this a transplane
ncplane_set_fg_rgb(ncp, 0xff, 0xff, 0xff); ncplane_set_fg_rgb(ncp, 0xff, 0xff, 0xff);
if(ncplane_printf_aligned(ncp, rows - 5, NCALIGN_CENTER, "notcurses %s. press 'q' to quit.", notcurses_version()) < 0){ if(ncplane_printf_aligned(ncp, rows - 5, NCALIGN_CENTER, "notcurses %s. press 'q' to quit.", notcurses_version()) < 0){
return -1; return -1;

View File

@ -1814,17 +1814,17 @@ int ncplane_move_yx(ncplane* n, int y, int x){
if(n == n->nc->stdscr){ if(n == n->nc->stdscr){
return -1; return -1;
} }
n->absy = y; n->absy = y + n->nc->stdscr->absy;
n->absx = x; n->absx = x + n->nc->stdscr->absx;
return 0; return 0;
} }
void ncplane_yx(const ncplane* n, int* y, int* x){ void ncplane_yx(const ncplane* n, int* y, int* x){
if(y){ if(y){
*y = n->absy; *y = n->absy - n->nc->stdscr->absy;
} }
if(x){ if(x){
*x = n->absx; *x = n->absx - n->nc->stdscr->absx;
} }
} }