diff --git a/include/notcurses.h b/include/notcurses.h index 70011bfd6..be5295653 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -108,12 +108,12 @@ typedef struct notcurses_options { // By default, we hide the cursor if possible. This flag inhibits use of // the civis capability, retaining the cursor. bool retain_cursor; - // We typically install a signal handler for SIGINT and SIGQUIT that restores - // the screen, and then calls the old signal handler. Set this to inhibit - // registration of any signal handlers. + // We typically install a signal handler for SIG{INT, SEGV, ABRT, QUIT} that + // restores the screen, and then calls the old signal handler. Set to inhibit + // registration of these signal handlers. bool no_quit_sighandlers; // We typically install a signal handler for SIGWINCH that generates a resize - // event in the notcurses_getc() queue. Set this to inhibit the handler. + // event in the notcurses_getc() queue. Set to inhibit this handler. bool no_winch_sighandler; // If non-NULL, notcurses_render() will write each rendered frame to this // FILE* in addition to outfp. This is used primarily for debugging. diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 67bf5e18e..3e252036d 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -48,7 +48,7 @@ sigwinch_handler(int signo){ } // this wildly unsafe handler will attempt to restore the screen upon -// reception of SIGINT, SIGSEGV, or SIGQUIT. godspeed you, black emperor! +// reception of SIG{INT, SEGV, ABRT, QUIT}. godspeed you, black emperor! static void fatal_handler(int signo){ notcurses* nc = atomic_load(&signal_nc); @@ -86,11 +86,14 @@ setup_signals(notcurses* nc, bool no_quit_sigs, bool no_winch_sig){ sa.sa_handler = fatal_handler; sigaddset(&sa.sa_mask, SIGINT); sigaddset(&sa.sa_mask, SIGQUIT); + sigaddset(&sa.sa_mask, SIGSEGV); + sigaddset(&sa.sa_mask, SIGABRT); sa.sa_flags = SA_RESETHAND; // don't try twice int ret = 0; ret |= sigaction(SIGINT, &sa, &oldact); ret |= sigaction(SIGQUIT, &sa, &oldact); ret |= sigaction(SIGSEGV, &sa, &oldact); + ret |= sigaction(SIGABRT, &sa, &oldact); if(ret){ atomic_store(&signal_nc, NULL); fprintf(stderr, "Error installing fatal signal handlers (%s)\n", @@ -2155,14 +2158,19 @@ int ncvisual_stream(notcurses* nc, ncvisual* ncv, int* averr){ } // if "retain_cursor" was set, we don't have these definitions FIXME -void notcurses_cursor_enable(struct notcurses* nc){ +void notcurses_cursor_enable(notcurses* nc){ if(nc->cnorm){ term_emit("cnorm", nc->cnorm, nc->ttyfp, false); } } -void notcurses_cursor_disable(struct notcurses* nc){ +void notcurses_cursor_disable(notcurses* nc){ if(nc->civis){ term_emit("civis", nc->civis, nc->ttyfp, false); } } + +int notcurses_refresh(notcurses* nc){ + // FIXME + return 0; +}