2 releases

0.0.2 Jul 29, 2020
0.0.1 Jul 16, 2020

#173 in Command-line interface

MIT/Apache

77KB
1.5K SLoC

ANSI terminal handling for Stakker

This is a work-in-progress. Only basic handling on UNIX is supported at the moment: output buffering, input key decoding and window resize detection.

Documentation

See the crate documentation.

License

This project is licensed under either the Apache License version 2 or the MIT license, at your option. (See LICENSE-APACHE and LICENSE-MIT).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

ANSI terminal handling for Stakker

This is a work-in-progress. Only UNIX and the first level described below is supported for now.

Eventually this will provide several levels of abstraction at which the application may interface to the terminal, from lowest to highest:

Output buffering, input decoding, resizes and features

This can be used for applications which prefer to generate the ANSI output sequences themselves directly, for example a pager or a simple editor. The application has maximum control and can use specific ANSI features to optimise its output (for example scroll regions).

The input handling decodes keypress sequences and forwards them to application code. Terminal resizes are detected and notified as soon as they occur. Terminal features such as 256 colour support are detected and notified to the application.

Full-screen page buffering and minimised updates

The application code keeps one or more full-screen pages in memory which it updates locally, and the terminal code keeps its own page which represents what is currently displayed on the terminal. When the application code wishes to update the terminal, the terminal code compares the two pages and sends a minimised update.

Input handling, resizes and features are handled the same as above.

Immediate mode UI

This will provide an immediate-mode UI (fields, widgets) on top of a full-screen buffer.

Dependencies

~1.5MB
~22K SLoC