notcurses-input: move legend to bottom row

We don't want to possibly draw an NCBLIT_PIXEL plot
over the bottom row, lest we incur undesirable
scrolling. Instead, move the legend from the top row
to the bottom row, and the plot one row above it.
pull/2122/head
nick black 3 years ago
parent 14533c4e73
commit 54c1d3bbae
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -153,7 +153,7 @@ static bool
dim_rows(const Plane* n){
int y, x;
Cell c;
for(y = 2 ; y < dimy ; ++y){
for(y = 0 ; y < dimy ; ++y){
for(x = 0 ; x < dimx ; ++x){
if(n->get_at(y, x, &c) < 0){
n->release(c);
@ -206,7 +206,7 @@ int input_demo(ncpp::NotCurses* nc) {
constexpr auto PLOTHEIGHT = 6;
auto n = nc->get_stdplane(&dimy, &dimx);
struct ncplane_options nopts = {
.y = dimy - PLOTHEIGHT,
.y = dimy - PLOTHEIGHT - 1,
.x = 0,
.rows = PLOTHEIGHT,
.cols = dimx,
@ -235,7 +235,7 @@ int input_demo(ncpp::NotCurses* nc) {
n->set_fg_rgb8(0x00, 0x00, 0x00);
n->set_bg_rgb8(0xbb, 0x64, 0xbb);
n->styles_on(CellStyle::Underline);
if(n->putstr(0, NCAlign::Center, "mash keys, yo. give that mouse some waggle! ctrl+d exits.") <= 0){
if(n->putstr(n->get_dim_y() - 1, NCAlign::Center, "mash keys, yo. give that mouse some waggle! ctrl+d exits.") <= 0){
ncuplot_destroy(plot);
return -1;
}
@ -245,7 +245,7 @@ int input_demo(ncpp::NotCurses* nc) {
ncuplot_destroy(plot);
return -1;
}
int y = 2;
int y = 0;
std::deque<wchar_t> cells;
char32_t r;
done = false;
@ -313,8 +313,8 @@ int input_demo(ncpp::NotCurses* nc) {
throw std::runtime_error("error rendering");
}
mtx.unlock();
if(++y >= dimy - PLOTHEIGHT){ // leave six lines free on the bottom...
y = 2; // ...and one free on the top.
if(++y >= dimy - PLOTHEIGHT - 1){
y = 0;
}
while(cells.size() >= dimy - 3u){
cells.pop_back();

Loading…
Cancel
Save