Backends

AppCUI supports various backends (but each one comes with advantages and drawbacks). A backend is the terminal that takes the information (characters) from the virtual screen of AppCUI and displays them.

Each backend supported by AppCUI has the following properties:

  • Output rendering - each character from the AppCUI surface is display on the screen
  • Input reading - the backend is capable of identifying keyboard and mouse events and convert them to internal AppCUI events
  • Clipboard support - the backend interacts with the OS and provides functionality for Copy / Cut / Paste based on OS-es API

The following backends are supported:

  1. Windows Console
  2. Windows VT (Virtual Terminal)
  3. NCurses
  4. Termios
  5. Web Terminal

Remarks: These types are available via appcui::backend::Type and can be used to initialize an application

#![allow(unused)]
fn main() {
let mut a = App::with_backend(apcui::backend::/*type*/).build()?;
}

where the appcui::backend::Type enum is defined as follows:

#![allow(unused)]
fn main() {
pub enum Type {
    #[cfg(target_os = "windows")]
    WindowsConsole,
    #[cfg(target_os = "windows")]
    WindowsVT,
    #[cfg(target_family = "unix")]
    Termios,
    #[cfg(target_os = "linux")]
    NcursesTerminal,
    #[cfg(target_arch = "wasm32")]
    WebTerminal,
}
}

OS Support

OSWindows ConsoleWindows VTNCursesTermiosWeb Terminal
WindowsYesYes---
Linux--YesYes-
Mac/OSX--YesYes-
Web----Yes

Display

DisplayWindows ConsoleWindows VTNCursesTermiosWeb Terminal
Colors16 (fore),16 (back)True colors16 (fore),16 (back)16 (fore),16 (back)16 (fore),16 (back)
Bold--Yes--
UnderlineYes-Yes-Yes
Italic-----
Character SetAscii,WTF-16Ascii,UTF-8Ascii,UTF-8Ascii,UTF-8Ascii,UTF-8
CursorYesYesYes-Yes

Keyboard

KeysWindows ConsoleWindows VTNCursesTermiosWeb Terminal
Alt+KeyYesYesWip-Yes
Shift+KeyYesYesYes-Yes
Ctrl+KeyYesYesYes-Yes
Alt+Shift+KeyYesYes---
Ctrl+Shift+KeyYesYes---
Ctrl+Alt+KeyYesYes---
Ctrl+Alt+Shift+KeyYesYes---
Alt pressedYesYes---
Shift pressedYesYes---
Ctrl pressedYesYes---

Mouse

Mouse eventsWindows ConsoleWindows VTNCursesTermiosWeb Terminal
ClickYesYesYesYesYes
Move & DragYesYesYesYesYes
WheelYesYesYes-Yes

System events

EventsWindows ConsoleWindows VTNCursesTermiosWeb Terminal
Console ResizeYesYesYes-Yes
Console closedYesYes--Yes

Other capabilities

CapabilitiesWindows ConsoleWindows VTNCursesTermiosWeb Terminal
Set dimensionYesYes--Yes
Set titleYesYes--Yes

Clipboard

AppCUI provides clipboard support for copying and pasting text. The clipboard functionality is available on the following backends:

BackendClipboard SupportAPI Used
Windows ConsoleYesWindows API
Windows VTYesWindows API
NCursesYesvia copypasta crate
Termios--
Web TerminalYesBrowser API

Defaults

By default, when using initializing a backend, the folowing will be used:

OSDefault backend
WindowsWindows Console
LinuxNCurses
Mac/OSXTermios