diff --git a/src/input/input.cpp b/src/input/input.cpp index 4a8f18b07..ff32c26a0 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -205,7 +205,7 @@ void Ticker(ncpp::NotCurses* nc) { int input_demo(ncpp::NotCurses* nc) { constexpr auto PLOTHEIGHT = 6; - auto n = std::make_unique(nc->get_stdplane(&dimy, &dimx)); + auto n = nc->get_stdplane(&dimy, &dimx); ncpp::Plane pplane{PLOTHEIGHT, dimx, dimy - PLOTHEIGHT, 0, nullptr}; struct ncplot_options popts{}; // FIXME would be nice to switch over to exponential at some level @@ -218,14 +218,14 @@ int input_demo(ncpp::NotCurses* nc) { if(!plot){ return EXIT_FAILURE; } - (*n)->set_fg_rgb(0x00, 0x00, 0x00); - (*n)->set_bg_rgb(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){ + n->set_fg_rgb(0x00, 0x00, 0x00); + n->set_bg_rgb(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){ return -1; } - (*n)->styles_set(CellStyle::None); - (*n)->set_bg_default(); + n->styles_set(CellStyle::None); + n->set_bg_default(); if(!nc->render()){ return -1; } @@ -253,35 +253,35 @@ int input_demo(ncpp::NotCurses* nc) { } mtx.unlock(); } - if(!(*n)->cursor_move(y, 0)){ + if(!n->cursor_move(y, 0)){ break; } - (*n)->set_fg_rgb(0xd0, 0xd0, 0xd0); - (*n)->printf("%c%c%c ", ni.alt ? 'A' : 'a', ni.ctrl ? 'C' : 'c', + n->set_fg_rgb(0xd0, 0xd0, 0xd0); + n->printf("%c%c%c ", ni.alt ? 'A' : 'a', ni.ctrl ? 'C' : 'c', ni.shift ? 'S' : 's'); if(r < 0x80){ - (*n)->set_fg_rgb(128, 250, 64); - if((*n)->printf("ASCII: [0x%02x (%03d)] '%lc'", r, r, - (wchar_t)(iswprint(r) ? r : printutf8(r))) < 0){ + n->set_fg_rgb(128, 250, 64); + if(n->printf("ASCII: [0x%02x (%03d)] '%lc'", r, r, + (wchar_t)(iswprint(r) ? r : printutf8(r))) < 0){ break; } }else{ if(nckey_supppuab_p(r)){ - (*n)->set_fg_rgb(250, 64, 128); - if((*n)->printf("Special: [0x%02x (%02d)] '%s'", r, r, nckeystr(r)) < 0){ + n->set_fg_rgb(250, 64, 128); + if(n->printf("Special: [0x%02x (%02d)] '%s'", r, r, nckeystr(r)) < 0){ break; } if(NCKey::IsMouse(r)){ - if((*n)->printf(-1, NCAlign::Right, " x: %d y: %d", ni.x, ni.y) < 0){ + if(n->printf(-1, NCAlign::Right, " x: %d y: %d", ni.x, ni.y) < 0){ break; } } }else{ - (*n)->set_fg_rgb(64, 128, 250); - (*n)->printf("Unicode: [0x%08x] '%lc'", r, (wchar_t)r); + n->set_fg_rgb(64, 128, 250); + n->printf("Unicode: [0x%08x] '%lc'", r, (wchar_t)r); } } - if(!dim_rows(*n)){ + if(!dim_rows(n)){ break; } const uint64_t sec = (timenow_to_ns() - start) / NANOSECS_IN_SEC; @@ -322,6 +322,8 @@ int main(void){ if(!nc.mouse_enable()){ return EXIT_FAILURE; } + // clear the screen in the absence of smcup mode + nc.refresh(nullptr, nullptr); int ret = input_demo(&nc); if(!nc.stop() || ret){ return EXIT_FAILURE;