mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
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.
This commit is contained in:
parent
14533c4e73
commit
54c1d3bbae
@ -153,7 +153,7 @@ static bool
|
|||||||
dim_rows(const Plane* n){
|
dim_rows(const Plane* n){
|
||||||
int y, x;
|
int y, x;
|
||||||
Cell c;
|
Cell c;
|
||||||
for(y = 2 ; y < dimy ; ++y){
|
for(y = 0 ; y < dimy ; ++y){
|
||||||
for(x = 0 ; x < dimx ; ++x){
|
for(x = 0 ; x < dimx ; ++x){
|
||||||
if(n->get_at(y, x, &c) < 0){
|
if(n->get_at(y, x, &c) < 0){
|
||||||
n->release(c);
|
n->release(c);
|
||||||
@ -206,7 +206,7 @@ int input_demo(ncpp::NotCurses* nc) {
|
|||||||
constexpr auto PLOTHEIGHT = 6;
|
constexpr auto PLOTHEIGHT = 6;
|
||||||
auto n = nc->get_stdplane(&dimy, &dimx);
|
auto n = nc->get_stdplane(&dimy, &dimx);
|
||||||
struct ncplane_options nopts = {
|
struct ncplane_options nopts = {
|
||||||
.y = dimy - PLOTHEIGHT,
|
.y = dimy - PLOTHEIGHT - 1,
|
||||||
.x = 0,
|
.x = 0,
|
||||||
.rows = PLOTHEIGHT,
|
.rows = PLOTHEIGHT,
|
||||||
.cols = dimx,
|
.cols = dimx,
|
||||||
@ -235,7 +235,7 @@ int input_demo(ncpp::NotCurses* nc) {
|
|||||||
n->set_fg_rgb8(0x00, 0x00, 0x00);
|
n->set_fg_rgb8(0x00, 0x00, 0x00);
|
||||||
n->set_bg_rgb8(0xbb, 0x64, 0xbb);
|
n->set_bg_rgb8(0xbb, 0x64, 0xbb);
|
||||||
n->styles_on(CellStyle::Underline);
|
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);
|
ncuplot_destroy(plot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ int input_demo(ncpp::NotCurses* nc) {
|
|||||||
ncuplot_destroy(plot);
|
ncuplot_destroy(plot);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int y = 2;
|
int y = 0;
|
||||||
std::deque<wchar_t> cells;
|
std::deque<wchar_t> cells;
|
||||||
char32_t r;
|
char32_t r;
|
||||||
done = false;
|
done = false;
|
||||||
@ -313,8 +313,8 @@ int input_demo(ncpp::NotCurses* nc) {
|
|||||||
throw std::runtime_error("error rendering");
|
throw std::runtime_error("error rendering");
|
||||||
}
|
}
|
||||||
mtx.unlock();
|
mtx.unlock();
|
||||||
if(++y >= dimy - PLOTHEIGHT){ // leave six lines free on the bottom...
|
if(++y >= dimy - PLOTHEIGHT - 1){
|
||||||
y = 2; // ...and one free on the top.
|
y = 0;
|
||||||
}
|
}
|
||||||
while(cells.size() >= dimy - 3u){
|
while(cells.size() >= dimy - 3u){
|
||||||
cells.pop_back();
|
cells.pop_back();
|
||||||
|
Loading…
Reference in New Issue
Block a user