-
Notifications
You must be signed in to change notification settings - Fork 245
Backends
To actually interface with the terminal, Cursive uses a backend library. While this currently defaults to crossterm, a few other backends are available and can be enabled with cargo features.
-
crossterm-backend
(default starting in cursive 0.21): uses the pure-rust crossterm library. Works crossplatform, even for windows systems down to version 7. -
ncurses-backend
(was the default up to cursive 0.20 included): uses the ncurses-rs library directly. Currently only compatible on Linux and macOS. Requires ncurses to be installed on the system. -
pancurses-backend
: uses the pancurses library, which forwards calls to ncurses-rs on Linux/macOS or pdcurses-sys on Windows. Requires ncurses to be installed on the system. -
termion-backend
: uses the pure-rust termion library. Works on Linux, macOS, and Redox. -
blt-backend
: uses the cross-platform BearLibTerminal.rs binding. Works on Linux and Windows.Note: BearLibTerminal is a graphical application emulating a terminal. There is an archlinux package, or you can download a release.
To use a different backend, you will have to disable the default features and enable the desired backend feature.
To run an example from the cursive source code, you can run:
cargo run -v --no-default-features --features pancurses-backend --example select
To select a specific backend in your application:
# Cargo.toml
[dependencies.cursive]
version = "0.20"
default-features = false
features = ["blt-backend"]
Or you can leave the choice to compilation time, forwarding cursive's features to your own application:
# Cargo.toml
[dependencies.cursive]
version = "0.20"
default-features = false
[features]
default = ["ncurses-backend"]
ncurses-backend = ["cursive/ncurses-backend"]
pancurses-backend = ["cursive/pancurses-backend"]
termion-backend = ["cursive/termion-backend"]
crossterm-backend = ["cursive/crossterm-backend"]
blt-backend = ["cursive/blt-backend"]
You need BearLibTerminal.lib file (to be downloaded on BearLibTerminal homepage) and copy it to
C:\Users\{Your Username}.multirust\toolchains\{current toolchain}\lib\rustlib\{current toolchain}\lib