mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
add NCDIRECT_NO_QUIT_SIGHANDLERS #1271
This commit is contained in:
parent
8b0de2aa1b
commit
998cf02f34
6
NEWS.md
6
NEWS.md
@ -1,6 +1,12 @@
|
||||
This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 2.1.4 (not yet released):
|
||||
* direct mode now supports `NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS`, and by
|
||||
default installs signal handlers similar to those of fullscreen mode.
|
||||
They will attempt to reset the terminal, and propagate the signal.
|
||||
* Add `channels_fg_palindex()` and `channels_bg_palindex()`.
|
||||
|
||||
* 2.1.3 (2020-12-31)
|
||||
* `ncdirect_styles_{set, on, off}()` have been deprecated in favor of
|
||||
`ncdirect_{set, on, off}_styles()`, to match `ncplane_` equivalents.
|
||||
|
@ -8,7 +8,13 @@ ncdirect_init - minimal notcurses instances for styling text
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
**#include <notcurses/direct.h>**
|
||||
```c
|
||||
#include <notcurses/direct.h>
|
||||
|
||||
#define NCDIRECT_OPTION_INHIBIT_SETLOCALE 0x0001ull
|
||||
#define NCDIRECT_OPTION_INHIBIT_CBREAK 0x0002ull
|
||||
#define NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS 0x0008ull
|
||||
```
|
||||
|
||||
**struct ncdirect* ncdirect_init(const char* ***termtype***, FILE* ***fp***, uint64_t ***flags***);**
|
||||
|
||||
@ -101,6 +107,11 @@ The following flags are defined:
|
||||
will place the terminal into cbreak mode (i.e. disabling echo and line
|
||||
buffering; see **tcgetattr(3)**).
|
||||
|
||||
* **NCDIRECT_OPTION_NO_QUIT_SIGHANDLERS**: A signal handler will usually be
|
||||
installed for **SIGINT**, **SIGQUIT**, **SIGSEGV**, **SIGTERM**, and
|
||||
**SIGABRT**, cleaning up the terminal on such exceptions. With this flag,
|
||||
the handler will not be installed.
|
||||
|
||||
An appropriate **terminfo(5)** entry must exist for the terminal. This entry is
|
||||
usually selected using the value of the **TERM** environment variable (see
|
||||
**getenv(3)**), but a non-**NULL** value for **termtype** will override this. An
|
||||
|
@ -25,6 +25,11 @@ typedef struct ncplane ncdirectv;
|
||||
// echo and input's line buffering are turned off.
|
||||
#define NCDIRECT_OPTION_INHIBIT_CBREAK 0x0002ull
|
||||
|
||||
// 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. Chosen to match fullscreen mode.
|
||||
#define NCDIRECT_NO_QUIT_SIGHANDLERS 0x0008ull
|
||||
|
||||
// Initialize a direct-mode Notcurses context on the connected terminal at 'fp'.
|
||||
// 'fp' must be a tty. You'll usually want stdout. Direct mode supports a
|
||||
// limited subset of Notcurses routines which directly affect 'fp', and neither
|
||||
|
@ -1272,11 +1272,11 @@ int notcurses_stop(notcurses* nc){
|
||||
nc->stashstats.render_bytes / (double)nc->stashstats.renders / 1024);
|
||||
}
|
||||
if(nc->stashstats.renders || nc->stashstats.failed_renders){
|
||||
fprintf(stderr, "%.1f theoretical FPS, %ju failed render%s, %ju refresh%s\n",
|
||||
nc->stashstats.renders ?
|
||||
NANOSECS_IN_SEC * (double)nc->stashstats.renders / nc->stashstats.render_ns : 0.0,
|
||||
fprintf(stderr, "%ju failed render%s, %ju failed write%s, %ju refresh%s\n",
|
||||
nc->stashstats.failed_renders,
|
||||
nc->stashstats.failed_renders == 1 ? "" : "s",
|
||||
nc->stashstats.failed_writeouts,
|
||||
nc->stashstats.failed_writeouts == 1 ? "" : "s",
|
||||
nc->stashstats.refreshes,
|
||||
nc->stashstats.refreshes == 1 ? "" : "es");
|
||||
fprintf(stderr, "RGB emits:elides: def %ju:%ju fg %ju:%ju bg %ju:%ju\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user