Skip to content

Default Termios support

Choose a tag to compare

@gdt050579 gdt050579 released this 14 Nov 18:28
· 312 commits to main since this release
ef57310

AppCUI-rs v0.5.9

This release makes Termios the default backend on Linux and macOS, and makes the NCurses and CrossTerm backends optional cargo features. A default build on Unix no longer needs the ncurses system library, the libc crate or crossterm.

⚠️ Breaking changes

  • The default backend on Linux is now Termios (it was NCurses). macOS also uses Termios by default.
  • NCurses is now an optional feature. backend::Type::NcursesTerminal only exists when the NCURSES feature is enabled, and it is never chosen by default. To keep using it:
    appcui = { version = "0.5.9", features = ["NCURSES"] }
    App::new().backend(appcui::backend::Type::NcursesTerminal).run()?;
    This feature also pulls in libc and needs the ncurses development library installed (libncursesw, e.g. sudo apt install libncurses-dev).
  • CrossTerm is no longer pulled in on Unix. backend::Type::CrossTerm requires the CROSSTERM feature on every platform.
  • Termios supports Linux and macOS only. Other Unix systems (FreeBSD, etc.) currently fail to compile with a clear error message.

✨ Termios backend

  • No libc dependency: <termios.h>, poll, read, ioctl and signal are bound directly, with separate definitions for Linux and macOS and compile-time size checks.
  • Fixed raw mode on Linux: the backend previously used the macOS termios layout, so on Linux the terminal stayed in line mode with echo on.
  • Terminal resize is detected and the screen is redrawn at the new size.
  • Mouse: SGR mouse reporting, with click, release, drag and move for the left, middle and right buttons.
  • Keyboard:
    • arrows, Home/End, Page Up/Down, Insert/Delete and F1–F12, with Shift/Alt/Ctrl modifiers (xterm encoding)
    • Shift+Tab
    • Alt+key sent as an Escape prefix
    • Ctrl+letter and other Ctrl combinations
  • The terminal is restored on exit, and the cursor is shown again.

🛠 Other changes

  • File system roots on Linux: total and free disk space are now read without libc (64-bit Linux). On macOS, sizes are reported as 0 for now.
  • Documentation and book updated for the new backend defaults and features, including a new NCurses page.

🐞 Known issues

  • Termios: the mouse wheel is not supported yet.
  • NCurses: the terminal is not reset when the app exits (endwin() is not called). Run reset if your shell stops echoing.
  • Unix clipboard: copy and paste can panic when no X11 or Wayland display is available (e.g. SSH, or WSL without WSLg).
  • macOS: the list of file system roots is empty.

🙌 Contributors

Full Changelog: v0.5.8...v0.5.9