From d5d827f38e1b7a3810e7fe5b13b3c435adfdc5bc Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 13 Mar 2020 06:53:52 -0400 Subject: [PATCH] adjust ncplane_yx() for margins --- src/demo/intro.c | 1 + src/lib/notcurses.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/demo/intro.c b/src/demo/intro.c index 964e51d18..28163bbfd 100644 --- a/src/demo/intro.c +++ b/src/demo/intro.c @@ -99,6 +99,7 @@ int intro(struct notcurses* nc){ return -1; } 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); if(ncplane_printf_aligned(ncp, rows - 5, NCALIGN_CENTER, "notcurses %s. press 'q' to quit.", notcurses_version()) < 0){ return -1; diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 749cd1d02..4f6a70023 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1814,17 +1814,17 @@ int ncplane_move_yx(ncplane* n, int y, int x){ if(n == n->nc->stdscr){ return -1; } - n->absy = y; - n->absx = x; + n->absy = y + n->nc->stdscr->absy; + n->absx = x + n->nc->stdscr->absx; return 0; } void ncplane_yx(const ncplane* n, int* y, int* x){ if(y){ - *y = n->absy; + *y = n->absy - n->nc->stdscr->absy; } if(x){ - *x = n->absx; + *x = n->absx - n->nc->stdscr->absx; } }