A new version of the notcurses library v1.4.x has been released: "the saga continues! wu-tang! wu-tang!"
Notcurses is a TUI library for modern terminal emulators. Literally translating to – not curses. It is written in C, using C++-safe headers. Wrappers are available for Rust, C++ and Python.
What it is: a library that simplifies complex TUIs on modern terminal emulators, maximally supporting bright colors and Unicode. Many tasks delegated to curses can be accomplished with notcurses (and vice versa).
What it is not: a compatible implementation of X/Open curses or a replacement for ncurses on existing systems.
Notcurses rejects the X/Open Curses API provided as part of the Single UNIX Specification. This specification is outdated and, for example, does not support terminal functionalities like unindexed 24-bit color. As such, notcurses is not a replacement for curses. It is less portable and definitely tested on a smaller range of hardware.
Where possible, notcurses uses the terminfo library provided with ncurses, leveraging its portability.
Notcurses opens up extended functionalities for user interaction on workstations, phones, laptops, and tablets.
Why use this non-standard library?
Thread-safety and efficient usage in multithreaded programs was a design consideration from the outset.
A better-designed API compared to X/Open:
Exported identifiers have a prefix to avoid namespace collisions.
The library's object file exports a minimal set of symbols. Where appropriate, static code is used only for lowercase headers. This facilitates compiler optimization and reduces load times.
-
All APIs initially support a universal character set (Unicode). The character cell API is based on the concept of Unicode's Extended Grapheme Cluster.
Visual capabilities including images, fonts, videos, high-contrast text, sprites, and transparent areas. All APIs natively support 24-bit color, quantized as needed for the terminal.
-
Apache2 License, unlike the drama in several acts, which is the ncurses license (the latter summarized as "a rephrasing of MIT-X11").
Since the previous significant release 1.1.0, a vast number of features have been added. Key changes:
A reading widget for inputting arbitrary form strings tied to reading strings.
A subprocess widget for spawning a subprocess, controlling it, and streaming its results back.
In Linux 5.3+, a new mechanism clone3+pidfd is used to manage processes without race conditions.
The Fdplane widget for streaming arbitrary file descriptors to a plane (on which the subprocess is built). Both allow callbacks to style or otherwise process text.
Rotation of planes and visual effects. Loading visualizations from memory. Arbitrary RGBA/BGRx blitting.
Menus can be placed on any (or both) of the top and bottom planes.
Significant improvements in Direct mode.
Polyfills, gradients, and high-contrast text.
Tetris added as an example.
C++ wrappers by Marek Habersack now have the ability to throw exceptions (if needed).
Python and Rust FFI have been updated and tested.
Video demo with commentary by the author.
The book "Hacking The Planet! with Notcurses" by the author.
Source: linux.org.ru

