unsegen
is a library facilitating the creation of text user interface (TUI) applications akin to ncurses.
Currently, unsegen
only provides a Rust interface.
The library consists of four modules:
Terminal
setup, "slicing" using Windows
, and formatted writing to Windows
using Cursors
.Widget
abstraction and some basic Widget
s useful for creating basic building blocks of text user interfaces.Behavior
and means to easily distribute events.Container
s as the combination of widget and input concepts.The following libraries are built on top of unsegen and provide higher level functionality:
unsegen
is available on crates.io. You can install it by adding this line to your Cargo.toml
:
toml
unsegen = "0.0.1"
There are examples at the top of each modules' documentation which should be sufficient to get you going.
For a fully fledged application using unsegen
, you can have a look at ugdb, which was developed alongside unsegen
and the primary motivation for it.
Here is a screenshot of ugdb, which is implemented on top of unsegen
.
((TODO))
For simplicity, layouting is done in every draw call.
This, in conjunction with recursive calls to calculate space demand of widgets, leads to not-so-great asymptotic runtime.
However, I found this not to be a problem in practice so far.
If this is problematic for, please file an issue.
There are workarounds (caching the draw
-result of widgets) for which convenient wrappers can be implemented in the library, but have not so far.
unsegen
is released under the MIT license.