Cross platform terminal library rust

Overview

Donate Travis Latest Version MIT docs Lines of Code Join us on Discord

Cross-platform Terminal Manipulation Library

Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform text-based interfaces (see features). It supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested, see Tested Terminals for more info).

Table of Contents

Features

  • Cross-platform
  • Multi-threaded (send, sync)
  • Detailed documentation
  • Few dependencies
  • Full control over writing and flushing output buffer
  • Is tty
  • Cursor
    • Move the cursor N times (up, down, left, right)
    • Move to previous / next line
    • Move to column
    • Set/get the cursor position
    • Store the cursor position and restore to it later
    • Hide/show the cursor
    • Enable/disable cursor blinking (not all terminals do support this feature)
  • Styled output
    • Foreground color (16 base colors)
    • Background color (16 base colors)
    • 256 (ANSI) color support (Windows 10 and UNIX only)
    • RGB color support (Windows 10 and UNIX only)
    • Text attributes like bold, italic, underscore, crossed, etc
  • Terminal
    • Clear (all lines, current line, from cursor down and up, until new line)
    • Scroll up, down
    • Set/get the terminal size
    • Exit current process
    • Alternate screen
    • Raw screen
    • Set terminal title
    • Enable/disable line wrapping
  • Event
    • Input Events
    • Mouse Events (press, release, position, button, drag)
    • Terminal Resize Events
    • Advanced modifier (SHIFT | ALT | CTRL) support for both mouse and key events and
    • futures Stream (feature 'event-stream')
    • Poll/read API

Tested Terminals

  • Console Host
    • Windows 10 (Pro)
    • Windows 8.1 (N)
  • Ubuntu Desktop Terminal
    • Ubuntu 17.10
    • Pop!_OS ( Ubuntu ) 20.04
  • (Arch, Manjaro) KDE Konsole
  • (Arch) Kitty
  • Linux Mint
  • OpenSuse/Linux Alacritty

This crate supports all UNIX terminals and Windows terminals down to Windows 7; however, not all of the terminals have been tested. If you have used this library for a terminal other than the above list without issues, then feel free to add it to the above list - I really would appreciate it!

Getting Started

see the examples directory and documentation for more advanced examples.

Click to show Cargo.toml.
[dependencies]
crossterm = "0.18"

use std::io::{stdout, Write};

use crossterm::{
    execute,
    style::{Color, Print, ResetColor, SetBackgroundColor, SetForegroundColor},
    ExecutableCommand, Result,
    event,
};

fn main() -> Result<()> {
    // using the macro
    execute!(
        stdout(),
        SetForegroundColor(Color::Blue),
        SetBackgroundColor(Color::Red),
        Print("Styled text here."),
        ResetColor
    )?;

    // or using functions
    stdout()
        .execute(SetForegroundColor(Color::Blue))?
        .execute(SetBackgroundColor(Color::Red))?
        .execute(Print("Styled text here."))?
        .execute(ResetColor)?;
    
    Ok(())
}

Checkout this list with all possible commands.

Feature Flags

To optional feature flags.

[dependencies.crossterm]
version = "0.17"
features = ["event-stream"] 
Feature Description
event-stream futures::Stream producing Result<Event>.

Dependency Justification

Dependency Used for Included
bitflags KeyModifiers, those are differ based on input. always
parking_lot locking RwLocks with a timeout, const mutexes. always
libc UNIX terminal_size/raw modes/set_title and several other lowlevel functionality. UNIX only
Mio event readiness polling, waking up poller UNIX only
signal-hook signalhook is used to handle terminal resize SIGNAL with Mio. UNIX only
winapi Used for low-level windows system calls which ANSI codes can't replace windows only
futures Can be used to for async stream of events only with a feature flag
serde Se/dese/realizing of events only with a feature flag

Other Resources

Used By

Contributing

We highly appreciate when anyone contributes to this crate. Before you do, please, read the Contributing guidelines.

Authors

  • Timon Post - Project Owner & creator

License

This project, crossterm and all its sub-crates: crossterm_screen, crossterm_cursor, crossterm_style, crossterm_input, crossterm_terminal, crossterm_winapi, crossterm_utils are licensed under the MIT License - see the LICENSE file for details.

Issues
  • Crossterm Input API-discussion

    Crossterm Input API-discussion

    In this issue, we will discuss all the API changes we want to make for crossterm_input.

    api_change help wanted in_progress 
    opened by TimonPost 29
  • Don't write on stdout if all commands are queued for stderr

    Don't write on stdout if all commands are queued for stderr

    When using the Command API and the alternate screen, I'd like to only use stderr for all displays in order to precisely decide what I write on stdout.

    It looks like it's almost possible but there are still some chars written on stdout even if I only queue on stderr.

    I suspect this is related to the few places where there are calls to write_cout without the first argument.

    Could we fix this ? Is it already in process ?

    It's possible a few API would have to change, for example for the alternate screen.

    opened by Canop 23
  • Added basic trait implementations to all Commands

    Added basic trait implementations to all Commands

    Added a small set of reasonable trait implementations (Debug, Copy, Clone, PartialEq, and Eq) to all of the commands. The largest command is a pair of u16, so they're easily copyable.

    opened by Lucretiel 23
  • Windows 10 / PowerShell Issues

    Windows 10 / PowerShell Issues

    I'm on Windows 10 and running my app in PowerShell console.

    My app reacts to Enter key (char 13), and it triggers the reaction immediately after the start. I tracked down the problem to the fact that it's processing the Enter key that I was using to invoke the command from the cli.

    I.e.:

    1. I type .\target\debug\myapp.exe
    2. I press "Enter" key.
    3. My app starts and immediately triggers "Enter" key handler (cauisng it to quit in my case).

    I expect step 3 to be "My app starts and waits for input".

    I tried both sync and async input - the behaviour is the same.

    I'm using fixes branch.

    opened by MOZGIII 19
  • Async reader doesn't produce MouseEvents

    Async reader doesn't produce MouseEvents

    • Platform: macOS
    • It works when I replace input.read_async(); with input.read_sync();
    • Run, click with the mouse and ...
    Screen Shot 2019-10-03 at 11 54 40

    examples/foo.rs:

    use crossterm_input::{InputEvent, KeyEvent, MouseEvent, RawScreen, Result, TerminalInput};
    
    fn main() -> Result<()> {
        let input = TerminalInput::new();
        let _raw = RawScreen::into_raw_mode()?;
    
        let mut reader = input.read_async();
        input.enable_mouse_mode()?;
    
        loop {
            if let Some(event) = reader.next() {
                match event {
                    InputEvent::Keyboard(KeyEvent::Esc) => break,
                    InputEvent::Keyboard(KeyEvent::Enter) => println!("Enter"),
                    InputEvent::Mouse(mouse) => {
                        match mouse {
                            MouseEvent::Press(_, x, y) => println!("Press: {}x{}", x, y),
                            MouseEvent::Hold(x, y) => println!("Move: {}x{}", x, y),
                            MouseEvent::Release(x, y) => println!("Release: {}x{}", x, y),
                            _ => {}
                        };
                    }
                    _ => {}
                };
            }
        }
    
        input.disable_mouse_mode()?;
        Ok(())
    }
    
    in_progress 
    opened by zrzka 18
  • Input Expansion

    Input Expansion

    This is a tracking issue for the work what still needs to be done for reading input.

    • [X] Reading Keys Presses This feature should porovide support for the following Key Events - winapi example code. - Special key combinations
    • [X] Mouse Events (example) - Allow to capture mouse down, up and hold events. - Allow seeing which mouse button is pressed.
    • [X] cleaning up old threads
    • [x] Testing
    enhancement 
    opened by TimonPost 16
  • Upgrading from 0.10.x to 0.12.x break input

    Upgrading from 0.10.x to 0.12.x break input

    Hi all,

    We use crossterm in nushell in a few different places, and have generally been pretty happy with it. Recently, I tried to update from 0.10.x to 0.12.x. While the API changes were easy to fix, the result was a system that no longer worked.

    Does someone have a minute to look over https://github.com/nushell/nushell/blob/master/src/fuzzysearch.rs and let me know why it doesn't work in 0.12.x (ignoring the slight API differences)

    Here are some of the issues we see with 0.12.x when we try it:

    • Hitting enter on a selection doesn't work
    • After fuzzy search runs, input is eaten about every other character, so you can't type in the nushell prompt correctly anymore
    opened by jonathandturner 16
  • Direct write command ansi_codes

    Direct write command ansi_codes

    This change many commands from format! -> String -> write! to single write!

    opened by Riey 15
  • Performance Enhancement

    Performance Enhancement

    Task Description

    Crossterm flushes the buffer each time action with an ANSI-code is performed. This is not realistic in the case of moving the cursor a lot and meanwhile print characters. When calling those types of functions a lot, cross-term might behave a bit slow.

    • Flushing is done here
    • Locking on stdout is done as well on each ANSI write to the terminal, however, flushing is way more performance bottleneck then the lock.

    Task TODO

    • [ ] Research if it is possible to let the user control the flushing so that the user can control when to flush the ANSI-commands to the terminal. Issue #167 can be related to this issue. More explanation about this in the comments.
    • [ ] If we found out a way to make ANSI-codes more performant, we are left with one problem. WINAPI. The nice think about ANSI codes is that you can queue them up somewhere and push them into the stdout later on. With WinApi the user interacts directly with the terminal, and you can't queue them in the same way of ANSI-codes.

    Example of what I mean:

    winapi scenario of moving the cursor

    Move cursor (10.10)
    println!("abc");
    Move cursor (10,10)
    

    ansi scenario to move the cursor

    println!("\x1B[{10};{10}H abc \x1B[{5};{5}H");
    

    As you can see, in the case of ANSI codes we can store the codes and text of the user inside on string, however, with WinApi we don't store actions inside a string. But those are calls that need to be made to the console individually.

    Somehow, we need to be able to store those WinApi commands in order ass well. So that if the user does a manual flush to the terminal, in the case of windows, we walk through all the WinApi commands queued and execute those, as well print the user input, done between those two cursor move events.

    Notice

    I do notice, Linux is way faster with console actions than windows is. I am not sure whether this is the problem of rust using winapi to write to the console window, winapi ANSI interpretation layer, crossterm performance issue. Windows is often forgotten in the Rust library, and would not be amazed if there is some performance issue there somewhere. But this needs to be proven of course.

    difficulty: hard enhancement help wanted 
    opened by TimonPost 15
  • Make read sync block for windows systems

    Make read sync block for windows systems

    The documentation of TerminalInput states for TerminalInput::read_sync:

    Readings will be blocking calls.

    On windows this will resolve in call to ReadConsoleInput and according to MSDN it blocks.

    The function does not return until at least one input record has been read.

    But there is a problematic fast return, causing ReadConsoleInput not to be called.

    https://github.com/TimonPost/crossterm/blob/8223cc9e4a5e35e15a0287bd9d8aa53dc84d1c34/crossterm_winapi/src/console.rs#L170-L173

    Also some events return None, even though further events can be received:

    https://github.com/TimonPost/crossterm/blob/8223cc9e4a5e35e15a0287bd9d8aa53dc84d1c34/crossterm_input/src/input/windows_input.rs#L230-L233

    While this is valid behaviour for iterators, this causes early returns when iterating with for or while. This should be either changed or documented.

    bug difficulty: medium 
    opened by matprec 15
  • macOS, backspace, and modifiers

    macOS, backspace, and modifiers

    Describe the bug This seems related to #504. On macOS, if you do Ctrl+Backspace or Alt+Backspace, crossterm reports these as Backspace with no modifiers.

    To Reproduce Steps to reproduce the behavior:

    1. Ctrl+Backspace
    2. or
    3. Alt+Backspace

    Expected behavior The correct modifiers are connect to the code.

    OS

    • macOS

    Terminal/Console

    • Standard macOS 10.15 terminal
    opened by jonathandturner 0
  • Incorrect color names in docs

    Incorrect color names in docs

    Describe the bug

    In the docs at Platform-specific Notes it says DarkWhite for the dark version of White and Grey for the light version of Black.

    Expected behavior

    The dark version of White should be Grey while the light version of Black should be DarkGrey. DarkWhite does not exist. At least this is how it is coded here.

    Just for interest, AFAIK the ANSI colors are defined as "normal" (e.g. "red") and "bright" (e.g. "bright red"). In crossterm, why are the colors named "dark" (e.g. DarkRed) for normal ANSI colors and "normal" (e.g. Red) for bright ANSI colors?

    opened by tobx 0
  • Support new terminal protocol for extended keys and more modifiers

    Support new terminal protocol for extended keys and more modifiers

    There is a new protocol that modern terminals will support, originally designed by fixterms and later adopted and finalized by kitty: https://sw.kovidgoyal.net/kitty/keyboard-protocol.html

    Supporting this protocol will allow you to distinguish many more keys and modifiers (see the page for full list of benefits), and probably fix a bunch of open issues related to the modifiers.

    opened by maximbaz 0
  • event polling example broken in windows git bash

    event polling example broken in windows git bash

    windows 10 and git-bash

    cargo r --example event-poll-read
    

    none of the expected events arrive:

    https://user-images.githubusercontent.com/776816/117581070-3789f500-b0fb-11eb-8cad-52525091ab75.mp4

    opened by extrawurst 1
  • Some unicode chars not working on windows terminal

    Some unicode chars not working on windows terminal

    Describe the bug Some unicode characters like emoji create no events when inserted into the terminal.

    To Reproduce

    1. Wait on input using event::read
    2. Insert emoji or other unicode character
    3. No event is created

    Expected behavior Emojis and other unicode chars should create key events where the KeyCode enum contains an char.

    OS Windows 10

    Terminal/Console Windows terminal

    opened by Kl4rry 0
  • [draft] Add Bracketed Paste Events

    [draft] Add Bracketed Paste Events

    https://github.com/crossterm-rs/crossterm/issues/545

    Couple of points:

    • I can flatten PasteEvents(Vec<Event>) to become PasteEvent(String)
    • I'm not sure how to restore Copy bound to Event
    • I think for winapi I should just stub it with Ok(())
    • Is flushing events like this https://github.com/crossterm-rs/crossterm/compare/master...sigmaSd:add_brakceted_paste_mode?expand=1#diff-835dd5a0632e3b0d7b10539464274511152432fac2dce69a999604c76c86f0f9R128 Ok?
    opened by sigmaSd 1
  • Tests fail on new Windows terminal when ran multiple times

    Tests fail on new Windows terminal when ran multiple times

    Not sure why but while I was working on the two PRs that got merged the other day (#555, #552), I noticed that running cargo test inside the new Windows terminal fails for a bunch of tests. They seem to pass CI though.

    Windows: 10 20H2 (19042.870) rustc: rustc 1.51.0 (2fd73fabe 2021-03-23)

    I think the reason is that the tests do not properly reset the terminal after they ran. Alongside that, they have to be run with a single thread to make them all pass. When trying to use the terminal after I ran the tests I always get "rendering artifacts". The lines are messed up, I overwrite stuff when typing that I shouldn't overwrite and similar problems.

    Not a problem for CI but might be something that should be investigated (even if it sounds boring :smile: )

    opened by SirWindfield 0
  • Add Event::Terminate

    Add Event::Terminate

    Is your feature request related to a problem? Please describe.

    Terminal program often face to SIGINT, SIGTERM and I think it's common to write handler for these signals

    so I have to use another crate like ctrl_c however crossterm already can do it will fit well with existing event loop

    Describe the solution you'd like

    Add new event variant for those termination signals Event::Exit, Event::Terminate, ... whatever

    Describe alternatives you've considered in any

    Additional context

    I have no idea how windows can make this event

    opened by Riey 9
  • Question: Rendering content in raw mode that exceeds current terminal viewport

    Question: Rendering content in raw mode that exceeds current terminal viewport

    I print a list of items inside of raw mode. If the user's prompt is at the bottom of the terminal viewport while I enter raw mode, the list does only get partially displayed. Lines that would exceed the current viewport are not rendered (the terminal doesn't automatically "scroll" down to show them).

    I am currently working around it by printing the number of required lines in normal mode and move up again before I enter raw mode. It works, but feels more like a hack.

    Is there a better workaround for this? I just wonder on how to deal with this in the cleanest way possible.

    let number_of_items = self.values.len();
    
    // XXX: Newlines are not processed inside of raw mode. Print the needed number
    // of lines on the console during normal mode to take advantage of "scrolling",
    // as the list items might be out of the current user's viewport otherwise.
    for _ in 1..number_of_items {
        queue!(stdout, Print("\n")).unwrap();
    }
    // Move back to the previous position.
    queue!(stdout, MoveToPreviousLine(number_of_items as u16)).unwrap();
    
    // Here I enter raw mode and print the list of items.
    for item in items {
    	queue!(stdout, Print(item), MoveToNextLine(1)).unwrap();
    }
    
    opened by SirWindfield 0
  • How can I use this library to develop a similar grammar prompt function?

    How can I use this library to develop a similar grammar prompt function?

    crossterm is a good terminal library. Recently I want to use it to develop a shell terminal. I want to add a grammar prompt to it. Just like bash, you can press the tab key to trigger a grammar prompt. How can I use this library to develop a similar grammar prompt function?

    opened by yancheng199287 1
Releases(0.20)
  • 0.20(Jun 10, 2021)

    • Update from signal-hook with 'mio-feature flag' to signal-hook-mio 0.2.1.
    • Manually implements Eq, PartialEq and Hash for KeyEvent improving equality checks and hash calculation.
    • crossterm::ErrorKind to io::Error.
    • Added Cursor Shape Support.
    • Add support for function keys F13...F20.
    • Support taking any Display in SetTitle command.
    • Remove lazy_static dependency.
    • Remove extra Clone bounds in the style module.
    • Add MoveToRow command.
    • Remove writer parameter from execute_winapi
    Source code(tar.gz)
    Source code(zip)
  • 0.19(Jun 10, 2021)

    • Use single thread for async event reader.
    • Patch timeout handling for event polling this was not working correctly.
    • Add unix support for more key combinations mainly complex ones with ALT/SHIFT/CTRL.
    • Derive PartialEq and Eq for ContentStyle
    • Fix windows resize event size, this used to be the buffer size but is screen size now.
    • Change Command::ansi_code to Command::write_ansi, this way the ansi code will be written to given formatter.
    Source code(tar.gz)
    Source code(zip)
  • 0.18(Sep 24, 2020)

    • Fix get position bug
    • Fix windows 8 or lower write to user-given stdout instead of stdout.
    • Make MoveCursor(Left/Right/Up/Dow) command with input 0 not move.
    • Switch to futures-core to reduce dependencies.
    • Command API restricts to only accept std::io::Write
    • Make supports_ansi public
    • Implement ALT + numbers windows systems.
    Source code(tar.gz)
    Source code(zip)
  • 0.17.7(Jul 20, 2020)

  • 0.17.6(Jul 6, 2020)

    • Add functionality to retrieve color based on passed ansi code.
    • Switch from 'futures' to 'futures-util' crate to reduce dependency count
    • Mio 0.7 update
    • signal-hook update
    • Make windows raw_mode act on CONIN$
    • Added From<(u8, u8, u8)> Trait to Color::Rgb Enum
    • Implement Color::try_from()
    • Implement styler traits for &'a str
    Source code(tar.gz)
    Source code(zip)
  • 0.17.5(May 23, 2020)

  • 0.17.4(May 18, 2020)

  • 0.17.3(May 18, 2020)

  • 0.17(Mar 24, 2020)

    • Impl Display for MoveToColumn, MoveToNextLine, MoveToPreviousLine
    • Make unix event reader always use /dev/tty.
    • Direct write command ansi_codes into formatter instead of double allocation.
    • Add NONE flag to KeyModifiers
    • Add support for converting chars to StylizedContent
    • Make terminal size function fallback to STDOUT_FILENO if /dev/tty is missing.
    Source code(tar.gz)
    Source code(zip)
  • 0.15(Jan 29, 2020)

    • Fix CTRL + J key combination. This used to return an ENTER event.
    • Add a generic implementation Command for &T: Command. This allows commands to be queued by reference, as well as by value.
    • Remove unnecessary Clone trait bounds from StyledContent.
    • Add StyledContent::style_mut.
    • Handle error correctly for execute! and queue!.
    • Fix minor syntax bug in execute! and queue!.
    • Change ContentStyle::apply to take self by value instead of reference, to prevent an unnecessary extra clone.
    • Added basic trait implementations (Debug, Clone, Copy, etc) to all of the command structs
    • ResetColor uses &'static str instead of String
    Source code(tar.gz)
    Source code(zip)
  • 0.14.1(Jan 11, 2020)

    • Made windows cursor position relative to the window instead absolute to the screen buffer windows.
    • Fix windows bug with queue macro were it consumed a type and required an type to be Copy.
    Source code(tar.gz)
    Source code(zip)
  • 0.14.2(Jan 11, 2020)

  • 0.14(Dec 16, 2019)

    • Replace the input module with brand new event module
      • Terminal Resize Events
      • Advanced modifier (SHIFT | ALT | CTRL) support for both mouse and key events and
      • futures Stream (feature 'event-stream')
      • Poll/read API
      • It's highly recommended to read the Upgrade from 0.13 to 0.14 documentation
    • Replace docs/UPGRADE.md with the Upgrade Paths documentation
    • Add MoveToColumn, MoveToPreviousLine, MoveToNextLine commands
    • Merge screen module into terminal
      • Remove screen::AlternateScreen
      • Remove screen::Rawscreen
        • Move and rename Rawscreen::into_raw_mode and Rawscreen::disable_raw_mode to terminal::enable_raw_mode and terminal::disable_raw_mode
      • Move screen::EnterAlternateScreen and screen::LeaveAlternateScreen to terminal::EnterAlternateScreen and terminal::LeaveAlternateScreen
      • Replace utils::Output command with style::Print command
    • Fix enable/disable mouse capture commands on Windows
    • Allow trailing comma queue! & execute! macros
    Source code(tar.gz)
    Source code(zip)
  • 0.13.1(Nov 4, 2019)

  • 0.13.2(Nov 4, 2019)

    • New input::stop_reading_thread() function
      • Temporary workaround for the UNIX platform to stop the background reading thread and close the file descriptor
      • This function will be removed in the next version
    Source code(tar.gz)
    Source code(zip)
  • 0.13(Nov 2, 2019)

    • Remove Crossterm type
    • Remove TerminalCursor, TerminalColor, Terminal
    • Remove cursor(), color() , terminal()
    • Remove re-exports at root, accessible via module::types (cursor::MoveTo)
    • input module
      • Derive 'Copy' for 'KeyEvent'
      • Add the EnableMouseCapture and EnableMouseCapture commands
    • cursor module
      • Introduce static function crossterm::cursor::position in place of TerminalCursor::pos
      • Rename Goto to MoveTo
      • Rename Up to MoveLeft
      • Rename Right to MoveRight
      • Rename Down to MoveDown
      • Rename BlinkOn to EnableBlinking
      • Rename BlinkOff to DisableBlinking
      • Rename ResetPos to ResetPosition
      • Rename SavePos to SavePosition
    • terminal
      • Introduce static function crossterm::terminal::size in place of Terminal::size
      • Introduce static function crossterm::terminal::exit in place of Terminal::exit
    • style module
      • Rename ObjectStyle to ContentStyle. Now full names are used for methods
      • Rename StyledObject to StyledContent and made members private
      • Rename PrintStyledFont to PrintStyledContent
      • Rename attr method to attribute.
      • Rename Attribute::NoInverse to NoReverse
      • Update documentation
      • Made Colored private, user should use commands instead
      • Rename SetFg -> SetForegroundColor
      • Rename SetBg -> SetBackgroundColor
      • Rename SetAttr -> SetAttribute
      • Rename ContentStyle::fg_color -> ContentStyle::foreground_color
      • Rename ContentStyle::bg_color -> ContentStyle::background_color
      • Rename ContentStyle::attrs -> ContentStyle::attributes
    • Improve documentation
    • Unix terminal size calculation with TPUT
    Source code(tar.gz)
    Source code(zip)
  • 0.12.0(Oct 21, 2019)

    • Following crates are deprecated and no longer maintained
      • crossterm_cursor
      • crossterm_input
      • crossterm_screen
      • crossterm_style
      • crossterm_terminal
      • crossterm_utils

    crossterm_cursor 0.4.0

    • Internal refactoring (PR #2)
      • Improved public documentation
      • sys module is no longer public
    • Fixed examples link (PR #6)
    • Sync documentation style (PR #7)
    • Removed all references to the crossterm book (PR #8)
    • Replaced RAW_MODE_ENABLED with is_raw_mode_enabled (PR #9)
    • Use SyncReader & InputEvent::CursorPosition for pos_raw() (PR #10)

    crossterm_input 0.5.0

    • Internal refactoring (PR #3)
      • Removed unsafe static mut
      • Documentation update
      • Remove all references to the crossterm book
    • Sync documentation style (PR #4)
    • Sync SyncReader::next() Windows and UNIX behavior (PR #5)
    • Remove all references to the crossterm book (PR #6)
    • Mouse coordinates synchronized with the cursor (PR #7)
      • Upper/left reported as (0, 0)
    • Fixed bug that read sync didn't block (Windows) (PR #8)
    • Refactored UNIX readers (PR #9)
      • AsyncReader produces mouse events
      • One reading thread per application, not per AsyncReader
      • Cursor position no longer consumed by another AsyncReader
      • Implemented sync reader for read_char (requires raw mode)
      • Fixed SIGTTIN when executed under the LLDB
      • Added mio for reading from FD and more efficient polling (UNIX only)
    • Sync UNIX and Windows vertical mouse position (PR #11)
      • Top is always reported as 0

    crossterm_screen 0.3.2

    • to_alternate switch back to main screen if it fails to switch into raw mode (PR #4)
    • Improve the documentation (PR #5)
      • Public API
      • Include the book content in the documentation
    • Remove all references to the crossterm book (PR #6)
    • New commands introduced (PR #7)
      • EnterAlternateScreen
      • LeaveAlternateScreen
    • Sync Windows and UNIX raw mode behavior (PR #8)

    crossterm_style 0.5.2

    • Refactoring (PR #2)
      • Added unit tests
      • Restructured files
      • Improved documentation and added book page to lib.rs
      • Fixed bug with SetBg command, WinApi logic
      • Fixed bug with StyledObject, used stdout for resetting terminal color
      • Introduced ResetColor command
    • Sync documentation style (PR #3)
    • Remove all references to the crossterm book (PR #4)
    • Windows 7 grey/white foreground/intensity swapped (PR #5)

    crossterm_terminal 0.3.2

    • Removed crossterm_cursor::sys dependency (PR #2)
    • Internal refactoring & documentation (PR #3)
    • Removed all references to the crossterm book (PR #4)

    crossterm_utils 0.4.0

    • Add deprecation note (PR #3)
    • Remove all references to the crossterm book (PR #4)
    • Remove unsafe static mut (PR #5)
      • sys::unix::RAW_MODE_ENABLED replaced with sys::unix::is_raw_mode_enabled() (breaking)
      • New lazy_static dependency

    crossterm_winapi 0.3.0

    • Make read sync block for windows systems (PR #2)
    Source code(tar.gz)
    Source code(zip)
  • 0.11.1(Sep 25, 2019)

  • 0.11.0(Sep 24, 2019)

    Changes crossterm 0.11.0

    As preparation for crossterm 0.1.0 we have moved crossterm to an organization called 'crossterm-rs'.

    Code Quality

    Important Changes

    • Return written bytes: return-written-bytes
    • Added derives: Debug for ObjectStyle debug-derive, Serialize/Deserialize for key events serde
    • Improved error handling:
      • Return crossterm::Result from all api's: return_crossterm_result
        • TerminalCursor::pos() returns Result<(u16, u16)>
        • Terminal::size() returns Result<(u16, u16)>
        • TerminalCursor::move_* returns crossterm::Result
        • ExecutableCommand::queue returns crossterm::Result
        • QueueableCommand::queue returns crossterm::Result
        • get_available_color_count returns no result
        • RawScreen::into_raw_mode returns crossterm::Result instead of io::Result
        • RawScreen::disable_raw_mode returns crossterm::Result instead of io::Result
        • AlternateScreen::to_alternate returns crossterm::Result instead of io::Result
        • TerminalInput::read_line returns crossterm::Result instead of io::Result
        • TerminalInput::read_char returns crossterm::Result instead of io::Result
        • Maybe I forgot something, a lot of functions have changed
      • Removed all unwraps/expects from library
    • Added KeyEvent::Enter and KeyEvent::Tab: added-key-event-enter, added-key-event-tab
    • Synced set/get terminal size behaviour: fixed-get-set-terminal-size
    • Method renames:
      • AsyncReader::stop_reading() to stop()
      • RawScreen::disable_raw_mode_on_drop to keep_raw_mode_on_drop
      • TerminalCursor::reset_position() to restore_position()
      • Command::get_anis_code() to ansi_code()
      • available_color_count to available_color_count()
      • Terminal::terminal_size to Terminal::size
      • Console::get_handle to Console::handle
    • All i16 values for indexing: set size, set cursor pos, scrolling synced to u16 values
    • Command API takes mutable self instead of self
    Source code(tar.gz)
    Source code(zip)
  • 0.9.6(Jun 15, 2019)

  • 0.9.5(May 20, 2019)

  • 0.6.0(May 15, 2019)

  • 0.7.0(May 15, 2019)

  • 0.8.0(May 15, 2019)

  • 0.9.0(May 15, 2019)

    This release is all about moving to a stabilized API for 1.0.

    • Major refactor and cleanup.
    • Improved performance;
      • No locking when writing to stdout.
      • UNIX doesn't have any dynamic dispatch anymore.
      • Windows has improved the way to check if ANSI modes are enabled.
      • Removed lot's of complex API calls: from_screen, from_output
      • Removed Arc<TerminalOutput> from all internal Api's.
    • Removed termios dependency for UNIX systems.
    • Upgraded deps.
    • Removed about 1000 lines of code
      • TerminalOutput
      • Screen
      • unsafe code
      • Some duplicated code introduced by a previous refactor.
    • Raw modes UNIX systems improved
    • Added NoItalic attribute
    Source code(tar.gz)
    Source code(zip)
    crossterm-0.9.0.zip(156.91 KB)
  • 0.9.4(May 15, 2019)

    • Reset foreground and background color individually. PR
    • Backtap input support. PR
    • Corrected white/grey and added dark grey.
    • Fixed getting cursor position with raw screen enabled. PR
    • Removed one redundant stdout lock
    Source code(tar.gz)
    Source code(zip)
Owner
crossterm-rs
Orginization that cares about terminal UI libraries.
crossterm-rs
Cross platform terminal library rust

Cross-platform Terminal Manipulation Library Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform te

crossterm-rs 1.2k Jun 15, 2021
Cross-platform Rust library for coloring and formatting terminal output

Coloring terminal output Documentation term-painter is a cross-platform (i.e. also non-ANSI terminals) Rust library for coloring and formatting termin

Lukas Kalbertodt 67 Mar 14, 2021
Alacritty - A fast, cross-platform, OpenGL terminal emulator

Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.

Alacritty 33.1k Jun 13, 2021
A cross-platform graphical process/system monitor with a customizable interface and a multitude of features

A cross-platform graphical process/system monitor with a customizable interface and a multitude of features. Supports Linux, macOS, and Windows. Inspired by both gtop and gotop.

Clement Tsang 2.1k Jun 7, 2021
A cat(1) clone with syntax highlighting and Git integration.

A cat(1) clone with syntax highlighting and Git integration. Key Features • How To Use • Installation • Customization • Project goals, alternatives [中

David Peter 27.5k Jun 10, 2021
A curated list of replacements for existing software written in Rust

Awesome Alternatives in Rust A curated list of replacements for existing software written in Rust. If you want to contribute, please read CONTRIBUTING

Takayuki Maeda 1.7k Jun 13, 2021
procs is a replacement for ps written in Rust.

procs is a replacement for ps written in Rust. Documentation quick links Features Platform Installation Usage Configuration Features Output by t

null 1.9k Jun 7, 2021
yayagram - Play nonograms/picross in your terminal

yayagram is a puzzle game in which you fill out a grid with cells based on logic and number clues.

r00ster 13 Jun 11, 2021
A Text User Interface library for the Rust programming language

Cursive Cursive is a TUI (Text User Interface) library for rust. It uses ncurses by default, but other backends are available. It allows you to build

Alexandre Bury 2.3k Jun 11, 2021
Cross-platform terminal screen clearing library

ClearScreen Cross-platform terminal screen clearing library. API documentation. Dual-licensed with Apache 2.0 and MIT. Uses Caretaker Maintainership.

null 9 May 22, 2021
Build terminal user interfaces and dashboards using Rust

tui-rs tui-rs is a Rust library to build rich terminal user interfaces and dashboards. It is heavily inspired by the Javascript library blessed-contri

Florian Dehau 5.2k Jun 13, 2021
Low-level Rust library for implementing terminal command line interface, like in embedded systems.

Terminal CLI Need to build an interactive command prompt, with commands, properties and with full autocomplete? This is for you. Example, output only

HashMismatch 38 Jun 14, 2021
A CLI utility installed as "ansi" to quickly get ANSI escape sequences. Supports the most basic ones, like colors and styles as bold or italic.

'ansi' - a CLI utility to quickly get ANSI escape codes This Rust project called ansi-escape-sequences-cli provides an executable called ansi which ca

Philipp Schuster 5 May 3, 2021
A Rust curses library, supports Unix platforms and Windows

pancurses pancurses is a curses library for Rust that supports both Linux and Windows by abstracting away the backend that it uses (ncurses-rs and pdc

Ilkka Halila 305 Jun 13, 2021