Cursive

Build Status crates.io MIT licensed

Cursive is a ncurses-based TUI (Text User Interface) library for rust. It is based on jeaye's ncurses-rs.

Documentation

It is designed to be safe and easy to use:

[dependencies] cursive = "0.0.3"

Or to use the latest git version:

[dependencies] cursive = { git = "https://github.com/gyscos/Cursive" }

(You will also need ncurses installed - if it isn't already, check in your package manager.)

```rust extern crate cursive;

use cursive::Cursive; use cursive::view::{TextView, Dialog};

fn main() { // Creates the cursive root - required for every application. let mut siv = Cursive::new();

// Creates a dialog with a single "Quit" button
siv.add_layer(Dialog::new(TextView::new("Hello Dialog!"))
                     .title("Cursive")
                     .button("Quit", |s| s.quit()));

// Starts the event loop.
siv.run();

} ```

Cursive dialog example

(Colors may depend on your terminal configuration.)

Goals

Non-goals

Compatibility

First off, terminals are messy. A small set of features is standard, but beyond that, almost every terminal has its own implementation.

Output

Input

Here is the support table for input keys. Tested terminals are mostly Gnome terminal and Linux TTY, xterm, and a few others now and then.

| | Key | Shift+Key | Ctrl+Key | Shift+Ctrl+Key | |--------------------------|:----:|:----------------------:|:--------------------------:|:---------------:| | Letters | All | All | All (except c,z,q,s,i,h,m) | None | | Numbers | All | All | None (can crash the app) | None | | Punctuation | All | All | None (can crash the app) | None | | Enter, Esc | All | None | None | None | | Left, Right arrow keys | All | VTE+Xterm | VTE+Xterm | VTE+Xterm | | Up, Down arrow keys | All | Xterm | VTE+Xterm | Xterm | | Ins | All | None (paste clipboard) | Xterm | None | | Del | All | VTE+Xterm | VTE+Xterm | VTE+Xterm | | Home, End | All | Xterm | Xterm | Xterm | | PageUp, PageDown | All | All | All | None | | Fn keys: F1-F4 | All | All except Konsole | Gnome+XTerm | Gnome+Xterm | | Fn keys: F5-F8 | All | All | All except TTY | All except TTY | | Fn keys: F9-F12 | All | All except TTY | All except TTY | All except TTY | | PrtScn, ScrollLock | None | None | None | None | | Window, Menu | None | None | None | None |

Contribute

You want to help? Great! Here is a non-exhaustive list of things you could do: