From 1ffd871784d1a98cb77a5607360994cf4fb886fe Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 8 Jun 2020 04:34:19 -0400 Subject: [PATCH] blocks poc: handle std coredump-free #645 --- src/demo/all.c | 3 ++- src/poc/blocks.cpp | 60 ++++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/demo/all.c b/src/demo/all.c index d957d038a..d94d2a4df 100644 --- a/src/demo/all.c +++ b/src/demo/all.c @@ -15,7 +15,8 @@ allglyphs(struct notcurses* nc, struct ncplane* column, int legendy){ // some of these cause major problems with Kitty, if not others, due to // heavy duty beating on freetype FIXME reenable when reasonable const int valid_planes[] = { - 0, 1, /*2,*/ 3, 14, /*15, 16,*/ -1 + 0, 1, 2, 3, 14, + /*15, 16,*/ -1 }; struct ncplane* std = notcurses_stdplane(nc); const int dimx = ncplane_dim_x(column); diff --git a/src/poc/blocks.cpp b/src/poc/blocks.cpp index b4965f1bc..296a5933e 100644 --- a/src/poc/blocks.cpp +++ b/src/poc/blocks.cpp @@ -13,38 +13,40 @@ auto main() -> int { notcurses_options nopts{}; nopts.flags = NCOPTION_INHIBIT_SETLOCALE | NCOPTION_NO_ALTERNATE_SCREEN; NotCurses nc(nopts); - std::unique_ptr n (nc.get_stdplane()); - int dimx, dimy; - nc.get_term_dim(&dimy, &dimx); + { + std::unique_ptr n (nc.get_stdplane()); + int dimx, dimy; + nc.get_term_dim(&dimy, &dimx); - const int HEIGHT = 5; - const int WIDTH = 20; - auto na = std::make_unique(n.get(), HEIGHT, WIDTH, - dimy - (HEIGHT + 1), - NCAlign::Center); - uint64_t channels = 0; - if(!na){ - goto err; - } - n->set_fg(0x00ff00); - na->set_fg(0x00ff00); - if(!na->cursor_move(0, 0)){ - goto err; - } - if(!na->rounded_box_sized(0, channels, HEIGHT, WIDTH, 0)){ - goto err; - } - if(n->printf(0, 0, "arrrrp?") < 0){ - goto err; - } - if(!n->rounded_box_sized(4, channels, HEIGHT, WIDTH, 0)){ - goto err; - } - if(!nc.render()){ - goto err; + const int HEIGHT = 5; + const int WIDTH = 20; + auto na = std::make_unique(n.get(), HEIGHT, WIDTH, + dimy - (HEIGHT + 1), + NCAlign::Center); + uint64_t channels = 0; + if(!na){ + goto err; + } + n->set_fg(0x00ff00); + na->set_fg(0x00ff00); + if(!na->cursor_move(0, 0)){ + goto err; + } + if(!na->rounded_box_sized(0, channels, HEIGHT, WIDTH, 0)){ + goto err; + } + if(n->printf(0, 0, "arrrrp?") < 0){ + goto err; + } + if(!n->rounded_box_sized(4, channels, HEIGHT, WIDTH, 0)){ + goto err; + } + if(!nc.render()){ + goto err; + } } sleep(1); - return nc.stop() ? EXIT_FAILURE : EXIT_SUCCESS; + return nc.stop() ? EXIT_SUCCESS : EXIT_FAILURE; err: return EXIT_FAILURE;