From 9b7238fdc9280df97feb8f2837041e552a9ef802 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 6 Dec 2020 03:06:02 -0500 Subject: [PATCH] demo: preserve plot/hud/etc. on shutdown If we're using -k to inhibit use of the alternate screen for notcurses-demo, we want to see what was on the screen when we quit. If we're actually quitting, don't destroy these components manually, so they remain visible. --- src/demo/demo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/demo/demo.c b/src/demo/demo.c index c91fccc36..6cc5dccdd 100644 --- a/src/demo/demo.c +++ b/src/demo/demo.c @@ -584,13 +584,15 @@ int main(int argc, char** argv){ if(ext_demos(nc, spec, ignore_failures)){ goto err; } - if(hud_destroy()){ // destroy here since notcurses_drop_planes will kill it - goto err; - } - if(fpsgraph_stop(nc)){ - goto err; + if(restart_demos){ + if(hud_destroy()){ // destroy here since notcurses_drop_planes will kill it + goto err; + } + if(fpsgraph_stop(nc)){ + goto err; + } + about_destroy(nc); } - about_destroy(nc); }while(restart_demos); ncmenu_destroy(menu); if(stop_input()){