1# Version 0.20 2- Update from signal-hook with 'mio-feature flag' to signal-hook-mio 0.2.1. 3- Manually implements Eq, PartialEq and Hash for KeyEvent improving equality checks and hash calculation. 4- `crossterm::ErrorKind` to `io::Error`. 5- Added Cursor Shape Support. 6- Add support for function keys F13...F20. 7- Support taking any Display in `SetTitle` command. 8- Remove lazy_static dependency. 9- Remove extra Clone bounds in the style module. 10 - Add `MoveToRow` command. 11 - Remove writer parameter from execute_winapi 12 13# Version 0.19 14- Use single thread for async event reader. 15- Patch timeout handling for event polling this was not working correctly. 16- Add unix support for more key combinations mainly complex ones with ALT/SHIFT/CTRL. 17- Derive `PartialEq` and `Eq` for ContentStyle 18- Fix windows resize event size, this used to be the buffer size but is screen size now. 19- Change `Command::ansi_code` to `Command::write_ansi`, this way the ansi code will be written to given formatter. 20 21# Version 0.18.2 22- Fix panic when only setting bold and redirecting stdout. 23- Use `tty_fd` for set/get terminal attributes 24 25# Version 0.18.1 26- Fix enabling ANSI support when stdout is redirected 27- Update crossterm-winapi to 0.6.2 28 29# Version 0.18.0 30- Fix get position bug 31- Fix windows 8 or lower write to user-given stdout instead of stdout. 32- Make MoveCursor(Left/Right/Up/Dow) command with input 0 not move. 33- Switch to futures-core to reduce dependencies. 34- Command API restricts to only accept `std::io::Write` 35- Make `supports_ansi` public 36- Implement ALT + numbers windows systems. 37 38# Version 0.17.7 39- Fix cursor position retrieval bug linux. 40 41# Version 0.17.6 42- Add functionality to retrieve color based on passed ansi code. 43- Switch from 'futures' to 'futures-util' crate to reduce dependency count 44- Mio 0.7 update 45- signal-hook update 46- Make windows raw_mode act on CONIN$ 47- Added From<(u8, u8, u8)> Trait to Color::Rgb Enum 48- Implement Color::try_from() 49- Implement styler traits for `&'a str` 50 51# Version 0.17.5 52- Improved support of keymodifier for linux, arrow keys, function keys, home keys etc. 53- Add `SetTitle` command to change the terminal title. 54- Mio 0.7 update 55 56# Version 0.17.4 57- Add macros for `Colorize` and `Styler` impls, add an impl for `String` 58- Add shift modifier to uppercase char events on unix 59 60# Version 0.17.3 61- Fix get terminal size mac os, this did not report the correct size. 62 63# Version 0.17.2 64- Windows unicode support 65 66# Version 0.17.1 67- Reverted bug in 0.17.0: "Make terminal size function fallback to `STDOUT_FILENO` if `/dev/tty` is missing.". 68- Support for querying whether the current instance is a TTY. 69 70# Version 0.17 71- Impl Display for MoveToColumn, MoveToNextLine, MoveToPreviousLine 72- Make unix event reader always use `/dev/tty`. 73- Direct write command ansi_codes into formatter instead of double allocation. 74- Add NONE flag to KeyModifiers 75- Add support for converting chars to StylizedContent 76- Make terminal size function fallback to `STDOUT_FILENO` if `/dev/tty` is missing. 77 78# Version 0.16.0 79- Change attribute vector in `ContentStyle` to bitmask. 80- Add `SetAttributes` command. 81- Add `Attributes` type, which is a bitfield of enabled attributes. 82- Remove `exit()`, was useless. 83 84# Version 0.15.0 85- Fix CTRL + J key combination. This used to return an ENTER event. 86- Add a generic implementation `Command` for `&T: Command`. This allows commands to be queued by reference, as well as by value. 87- Remove unnecessary `Clone` trait bounds from `StyledContent`. 88- Add `StyledContent::style_mut`. 89- Handle error correctly for `execute!` and `queue!`. 90- Fix minor syntax bug in `execute!` and `queue!`. 91- Change `ContentStyle::apply` to take self by value instead of reference, to prevent an unnecessary extra clone. 92- Added basic trait implementations (`Debug`, `Clone`, `Copy`, etc) to all of the command structs 93- `ResetColor` uses `&'static str` instead of `String` 94 95# Version 0.14.2 96- Fix TIOCGWINSZ for FreeBSD 97 98# Version 0.14.1 99- Made windows cursor position relative to the window instead absolute to the screen buffer windows. 100- Fix windows bug with `queue` macro were it consumed a type and required an type to be `Copy`. 101 102# Version 0.14 103 104- Replace the `input` module with brand new `event` module 105 - Terminal Resize Events 106 - Advanced modifier (SHIFT | ALT | CTRL) support for both mouse and key events and 107 - futures Stream (feature 'event-stream') 108 - Poll/read API 109 - It's **highly recommended** to read the 110 [Upgrade from 0.13 to 0.14](https://github.com/crossterm-rs/crossterm/wiki/Upgrade-from-0.13-to-0.14) 111 documentation 112- Replace `docs/UPGRADE.md` with the [Upgrade Paths](https://github.com/crossterm-rs/crossterm/wiki#upgrade-paths) 113 documentation 114- Add `MoveToColumn`, `MoveToPreviousLine`, `MoveToNextLine` commands 115- Merge `screen` module into `terminal` 116 - Remove `screen::AlternateScreen` 117 - Remove `screen::Rawscreen` 118 * Move and rename `Rawscreen::into_raw_mode` and `Rawscreen::disable_raw_mode` to `terminal::enable_raw_mode` and `terminal::disable_raw_mode` 119 - Move `screen::EnterAlternateScreen` and `screen::LeaveAlternateScreen` to `terminal::EnterAlternateScreen` and `terminal::LeaveAlternateScreen` 120 - Replace `utils::Output` command with `style::Print` command 121- Fix enable/disable mouse capture commands on Windows 122- Allow trailing comma `queue!` & `execute!` macros 123 124# Version 0.13.3 125 126- Remove thread from AsyncReader on Windows. 127- Improve HANDLE management windows. 128 129# Version 0.13.2 130 131- New `input::stop_reading_thread()` function 132 - Temporary workaround for the UNIX platform to stop the background 133 reading thread and close the file descriptor 134 - This function will be removed in the next version 135 136# Version 0.13.1 137 138- Async Reader fix, join background thread and avoid looping forever on windows. 139 140# Version 0.13.0 141 142**Major API-change, removed old-api** 143 144- Remove `Crossterm` type 145- Remove `TerminalCursor`, `TerminalColor`, `Terminal` 146- Remove `cursor()`, `color()` , `terminal()` 147- Remove re-exports at root, accessible via `module::types` (`cursor::MoveTo`) 148- `input` module 149 - Derive 'Copy' for 'KeyEvent' 150 - Add the `EnableMouseCapture` and `EnableMouseCapture` commands 151- `cursor` module 152 - Introduce static function `crossterm::cursor::position` in place of `TerminalCursor::pos` 153 - Rename `Goto` to `MoveTo` 154 - Rename `Up` to `MoveLeft` 155 - Rename `Right` to `MoveRight` 156 - Rename `Down` to `MoveDown` 157 - Rename `BlinkOn` to `EnableBlinking` 158 - Rename `BlinkOff` to `DisableBlinking` 159 - Rename `ResetPos` to `ResetPosition` 160 - Rename `SavePos` to `SavePosition` 161- `terminal` 162 - Introduce static function `crossterm::terminal::size` in place of `Terminal::size` 163 - Introduce static function `crossterm::terminal::exit` in place of `Terminal::exit` 164- `style module` 165 - Rename `ObjectStyle` to `ContentStyle`. Now full names are used for methods 166 - Rename `StyledObject` to `StyledContent` and made members private 167 - Rename `PrintStyledFont` to `PrintStyledContent` 168 - Rename `attr` method to `attribute`. 169 - Rename `Attribute::NoInverse` to `NoReverse` 170 - Update documentation 171 - Made `Colored` private, user should use commands instead 172 - Rename `SetFg` -> `SetForegroundColor` 173 - Rename `SetBg` -> `SetBackgroundColor` 174 - Rename `SetAttr` -> `SetAttribute` 175 - Rename `ContentStyle::fg_color` -> `ContentStyle::foreground_color` 176 - Rename `ContentStyle::bg_color` -> `ContentStyle::background_color` 177 - Rename `ContentStyle::attrs` -> `ContentStyle::attributes` 178- Improve documentation 179- Unix terminal size calculation with TPUT 180 181# Version 0.12.1 182 183- Move all the `crossterm_` crates code was moved to the `crossterm` crate 184 - `crossterm_cursor` is in the `cursor` module, etc. 185 - All these modules are public 186- No public API breaking changes 187 188# Version 0.12.0 189 190- Following crates are deprecated and no longer maintained 191 - `crossterm_cursor` 192 - `crossterm_input` 193 - `crossterm_screen` 194 - `crossterm_style` 195 - `crossterm_terminal` 196 - `crossterm_utils` 197 198## `crossterm_cursor` 0.4.0 199 200- Fix examples link ([PR #6](https://github.com/crossterm-rs/crossterm-cursor/pull/6)) 201- Sync documentation style ([PR #7](https://github.com/crossterm-rs/crossterm-cursor/pull/7)) 202- Remove all references to the crossterm book ([PR #8](https://github.com/crossterm-rs/crossterm-cursor/pull/8)) 203- Replace `RAW_MODE_ENABLED` with `is_raw_mode_enabled` ([PR #9](https://github.com/crossterm-rs/crossterm-cursor/pull/9)) 204- Use `SyncReader` & `InputEvent::CursorPosition` for `pos_raw()` ([PR #10](https://github.com/crossterm-rs/crossterm-cursor/pull/10)) 205 206## `crossterm_input` 0.5.0 207 208- Sync documentation style ([PR #4](https://github.com/crossterm-rs/crossterm-input/pull/4)) 209- Sync `SyncReader::next()` Windows and UNIX behavior ([PR #5](https://github.com/crossterm-rs/crossterm-input/pull/5)) 210- Remove all references to the crossterm book ([PR #6](https://github.com/crossterm-rs/crossterm-input/pull/6)) 211- Mouse coordinates synchronized with the cursor ([PR #7](https://github.com/crossterm-rs/crossterm-input/pull/7)) 212 - Upper/left reported as `(0, 0)` 213- Fix bug that read sync didn't block (Windows) ([PR #8](https://github.com/crossterm-rs/crossterm-input/pull/8)) 214- Refactor UNIX readers ([PR #9](https://github.com/crossterm-rs/crossterm-input/pull/9)) 215 - AsyncReader produces mouse events 216 - One reading thread per application, not per `AsyncReader` 217 - Cursor position no longer consumed by another `AsyncReader` 218 - Implement sync reader for read_char (requires raw mode) 219 - Fix `SIGTTIN` when executed under the LLDB 220 - Add mio for reading from FD and more efficient polling (UNIX only) 221- Sync UNIX and Windows vertical mouse position ([PR #11](https://github.com/crossterm-rs/crossterm-input/pull/11)) 222 - Top is always reported as `0` 223 224## `crossterm_screen` 0.3.2 225 226- `to_alternate` switch back to main screen if it fails to switch into raw mode ([PR #4](https://github.com/crossterm-rs/crossterm-screen/pull/4)) 227- Improve the documentation ([PR #5](https://github.com/crossterm-rs/crossterm-screen/pull/5)) 228 - Public API 229 - Include the book content in the documentation 230- Remove all references to the crossterm book ([PR #6](https://github.com/crossterm-rs/crossterm-screen/pull/6)) 231- New commands introduced ([PR #7](https://github.com/crossterm-rs/crossterm-screen/pull/7)) 232 - `EnterAlternateScreen` 233 - `LeaveAlternateScreen` 234- Sync Windows and UNIX raw mode behavior ([PR #8](https://github.com/crossterm-rs/crossterm-screen/pull/8)) 235 236## `crossterm_style` 0.5.2 237 238- Refactor ([PR #2](https://github.com/crossterm-rs/crossterm-style/pull/2)) 239 - Added unit tests 240 - Improved documentation and added book page to `lib.rs` 241 - Fixed bug with `SetBg` command, WinApi logic 242 - Fixed bug with `StyledObject`, used stdout for resetting terminal color 243 - Introduced `ResetColor` command 244- Sync documentation style ([PR #3](https://github.com/crossterm-rs/crossterm-style/pull/3)) 245- Remove all references to the crossterm book ([PR #4](https://github.com/crossterm-rs/crossterm-style/pull/4)) 246- Windows 7 grey/white foreground/intensity swapped ([PR #5](https://github.com/crossterm-rs/crossterm-style/pull/5)) 247 248## `crossterm_terminal` 0.3.2 249 250- Removed `crossterm_cursor::sys` dependency ([PR #2](https://github.com/crossterm-rs/crossterm-terminal/pull/2)) 251- Internal refactoring & documentation ([PR #3](https://github.com/crossterm-rs/crossterm-terminal/pull/3)) 252- Removed all references to the crossterm book ([PR #4](https://github.com/crossterm-rs/crossterm-terminal/pull/4)) 253 254## `crossterm_utils` 0.4.0 255 256- Add deprecation note ([PR #3](https://github.com/crossterm-rs/crossterm-utils/pull/3)) 257- Remove all references to the crossterm book ([PR #4](https://github.com/crossterm-rs/crossterm-utils/pull/4)) 258- Remove unsafe static mut ([PR #5](https://github.com/crossterm-rs/crossterm-utils/pull/5)) 259 - `sys::unix::RAW_MODE_ENABLED` replaced with `sys::unix::is_raw_mode_enabled()` (breaking) 260 - New `lazy_static` dependency 261 262## `crossterm_winapi` 0.3.0 263 264- Make read sync block for windows systems ([PR #2](https://github.com/crossterm-rs/crossterm-winapi/pull/2)) 265 266# Version 0.11.1 267 268- Maintenance release 269- All sub-crates were moved to their own repositories in the `crossterm-rs` organization 270 271# Version 0.11.0 272 273As a preparation for crossterm 0.1.0 we have moved crossterm to an organisation called 'crossterm-rs'. 274 275### Code Quality 276 277- Code Cleanup: [warning-cleanup], [crossterm_style-cleanup], [crossterm_screen-cleanup], [crossterm_terminal-cleanup], [crossterm_utils-cleanup], [2018-cleanup], [api-cleanup-1], [api-cleanup-2], [api-cleanup-3] 278- Examples: [example-cleanup_1], [example-cleanup_2], [example-fix], [commandbar-fix], [snake-game-improved] 279- Fixed all broken tests and added tests 280 281### Important Changes 282 283- Return written bytes: [return-written-bytes] 284- Added derives: `Debug` for `ObjectStyle` [debug-derive], Serialize/Deserialize for key events [serde] 285- Improved error handling: 286 - Return `crossterm::Result` from all api's: [return_crossterm_result] 287 * `TerminalCursor::pos()` returns `Result<(u16, u16)>` 288 * `Terminal::size()` returns `Result<(u16, u16)>` 289 * `TerminalCursor::move_*` returns `crossterm::Result` 290 * `ExecutableCommand::queue` returns `crossterm::Result` 291 * `QueueableCommand::queue` returns `crossterm::Result` 292 * `get_available_color_count` returns no result 293 * `RawScreen::into_raw_mode` returns `crossterm::Result` instead of `io::Result` 294 * `RawScreen::disable_raw_mode` returns `crossterm::Result` instead of `io::Result` 295 * `AlternateScreen::to_alternate` returns `crossterm::Result` instead of `io::Result` 296 * `TerminalInput::read_line` returns `crossterm::Result` instead of `io::Result` 297 * `TerminalInput::read_char` returns `crossterm::Result` instead of `io::Result` 298 * Maybe I forgot something, a lot of functions have changed 299 - Removed all unwraps/expects from library 300- Add KeyEvent::Enter and KeyEvent::Tab: [added-key-event-enter], [added-key-event-tab] 301- Sync set/get terminal size behaviour: [fixed-get-set-terminal-size] 302- Method renames: 303 * `AsyncReader::stop_reading()` to `stop()` 304 * `RawScreen::disable_raw_mode_on_drop` to `keep_raw_mode_on_drop` 305 * `TerminalCursor::reset_position()` to `restore_position()` 306 * `Command::get_anis_code()` to `ansi_code()` 307 * `available_color_count` to `available_color_count()` 308 * `Terminal::terminal_size` to `Terminal::size` 309 * `Console::get_handle` to `Console::handle` 310- All `i16` values for indexing: set size, set cursor pos, scrolling synced to `u16` values 311- Command API takes mutable self instead of self 312 313[serde]: https://github.com/crossterm-rs/crossterm/pull/190 314 315[debug-derive]: https://github.com/crossterm-rs/crossterm/pull/192 316[example-fix]: https://github.com/crossterm-rs/crossterm/pull/193 317[commandbar-fix]: https://github.com/crossterm-rs/crossterm/pull/204 318 319[warning-cleanup]: https://github.com/crossterm-rs/crossterm/pull/198 320[example-cleanup_1]: https://github.com/crossterm-rs/crossterm/pull/196 321[example-cleanup_2]: https://github.com/crossterm-rs/crossterm/pull/225 322[snake-game-improved]: https://github.com/crossterm-rs/crossterm/pull/231 323[crossterm_style-cleanup]: https://github.com/crossterm-rs/crossterm/pull/208 324[crossterm_screen-cleanup]: https://github.com/crossterm-rs/crossterm/pull/209 325[crossterm_terminal-cleanup]: https://github.com/crossterm-rs/crossterm/pull/210 326[crossterm_utils-cleanup]: https://github.com/crossterm-rs/crossterm/pull/211 327[2018-cleanup]: https://github.com/crossterm-rs/crossterm/pull/222 328[wild-card-cleanup]: https://github.com/crossterm-rs/crossterm/pull/224 329 330[api-cleanup-1]: https://github.com/crossterm-rs/crossterm/pull/235 331[api-cleanup-2]: https://github.com/crossterm-rs/crossterm/pull/238 332[api-cleanup-3]: https://github.com/crossterm-rs/crossterm/pull/240 333 334[return-written-bytes]: https://github.com/crossterm-rs/crossterm/pull/212 335 336[return_crossterm_result]: https://github.com/crossterm-rs/crossterm/pull/232 337[added-key-event-tab]: https://github.com/crossterm-rs/crossterm/pull/239 338[added-key-event-enter]: https://github.com/crossterm-rs/crossterm/pull/236 339[fixed-get-set-terminal-size]: https://github.com/crossterm-rs/crossterm/pull/242 340 341# Version 0.10.1 342 343# Version 0.10.0 ~ yanked 344- Implement command API, to have better performance and more control over how and when commands are executed. [PR](https://github.com/crossterm-rs/crossterm/commit/1a60924abd462ab169b6706aab68f4cca31d7bc2), [issue](https://github.com/crossterm-rs/crossterm/issues/171) 345- Fix showing, hiding cursor windows implementation 346- Remove some of the parsing logic from windows keys to ansi codes to key events [PR](https://github.com/crossterm-rs/crossterm/commit/762c3a9b8e3d1fba87acde237f8ed09e74cd9ecd) 347- Made terminal size 1-based [PR](https://github.com/crossterm-rs/crossterm/commit/d689d7e8ed46a335474b8262bd76f21feaaf0c50) 348- Add some derives 349 350# Version 0.9.6 351 352- Copy for KeyEvent 353- CTRL + Left, Down, Up, Right key support 354- SHIFT + Left, Down, Up, Right key support 355- Fixed UNIX cursor position bug [issue](https://github.com/crossterm-rs/crossterm/issues/140), [PR](https://github.com/crossterm-rs/crossterm/pull/152) 356 357# Version 0.9.5 358 359- Prefetch buffer size for more efficient windows input reads. [PR](https://github.com/crossterm-rs/crossterm/pull/144) 360 361# Version 0.9.4 362 363- Reset foreground and background color individually. [PR](https://github.com/crossterm-rs/crossterm/pull/138) 364- Backtap input support. [PR](https://github.com/crossterm-rs/crossterm/pull/129) 365- Corrected white/grey and added dark grey. 366- Fixed getting cursor position with raw screen enabled. [PR](https://github.com/crossterm-rs/crossterm/pull/134) 367- Removed one redundant stdout lock 368 369# Version 0.9.3 370 371- Removed println from `SyncReader` 372 373## Version 0.9.2 374 375- Terminal size linux was not 0-based 376- Windows mouse input event position was 0-based ans should be 1-based 377- Result, ErrorKind are made re-exported 378- Fixed some special key combination detections for UNIX systems 379- Made FreeBSD compile 380 381## Version 0.9.1 382 383- Fixed libc compile error 384 385## Version 0.9.0 (yanked) 386 387This release is all about moving to a stabilized API for 1.0. 388 389- Major refactor and cleanup. 390- Improved performance; 391 - No locking when writing to stdout. 392 - UNIX doesn't have any dynamic dispatch anymore. 393 - Windows has improved the way to check if ANSI modes are enabled. 394 - Removed lot's of complex API calls: `from_screen`, `from_output` 395 - Removed `Arc<TerminalOutput>` from all internal Api's. 396- Removed termios dependency for UNIX systems. 397- Upgraded deps. 398- Removed about 1000 lines of code 399 - `TerminalOutput` 400 - `Screen` 401 - unsafe code 402 - Some duplicated code introduced by a previous refactor. 403- Raw modes UNIX systems improved 404- Added `NoItalic` attribute 405 406## Version 0.8.2 407 408- Bug fix for sync reader UNIX. 409 410## Version 0.8.1 411 412- Added public re-exports for input. 413 414# Version 0.8.0 415 416- Introduced KeyEvents 417- Introduced MouseEvents 418- Upgraded crossterm_winapi 0.2 419 420# Version 0.7.0 421 422- Introduced more `Attributes` 423- Introduced easier ways to style text [issue 87](https://github.com/crossterm-rs/crossterm/issues/87). 424- Removed `ColorType` since it was unnecessary. 425 426# Version 0.6.0 427 428- Introduced feature flags; input, cursor, style, terminal, screen. 429- All modules are moved to their own crate. 430- Introduced crossterm workspace 431- Less dependencies. 432- Improved namespaces. 433 434[PR 84](https://github.com/crossterm-rs/crossterm/pull/84) 435 436# Version 0.5.5 437 438- Error module is made public [PR 78](https://github.com/crossterm-rs/crossterm/pull/78). 439 440# Version 0.5.4 441 442- WinApi rewrite and correctly error handled [PR 67](https://github.com/crossterm-rs/crossterm/pull/67) 443- Windows attribute support [PR 62](https://github.com/crossterm-rs/crossterm/pull/62) 444- Readline bug fix windows systems [PR 62](https://github.com/crossterm-rs/crossterm/pull/62) 445- Error handling improvement. 446- General refactoring, all warnings removed. 447- Documentation improvement. 448 449# Version 0.5.1 450 451- Documentation refactor. 452- Fixed broken API documentation [PR 53](https://github.com/crossterm-rs/crossterm/pull/53). 453 454# Version 0.5.0 455 456- Added ability to pause the terminal [issue](https://github.com/crossterm-rs/crossterm/issues/39) 457- RGB support for Windows 10 systems 458- ANSI color value (255) color support 459- More convenient API, no need to care about `Screen` unless working with when working with alternate or raw screen [PR](https://github.com/crossterm-rs/crossterm/pull/44) 460- Implemented Display for styled object 461 462# Version 0.4.3 463 464- Fixed bug [issue 41](https://github.com/crossterm-rs/crossterm/issues/41) 465 466# Version 0.4.2 467 468- Added functionality to make a styled object writable to screen [issue 33](https://github.com/crossterm-rs/crossterm/issues/33) 469- Added unit tests. 470- Bugfix with getting terminal size unix. 471- Bugfix with returning written bytes [pull request 31](https://github.com/crossterm-rs/crossterm/pull/31) 472- removed methods calls: `as_any()` and `as_any_mut()` from `TerminalOutput` 473 474# Version 0.4.1 475 476- Fixed resizing of ansi terminal with and height where in the wrong order. 477 478# Version 0.4.0 479 480- Input support (read_line, read_char, read_async, read_until_async) 481- Styling module improved 482- Everything is multithreaded (`Send`, `Sync`) 483- Performance enhancements: removed mutexes, removed state manager, removed context type removed unnecessarily RC types. 484- Bug fix resetting console color. 485- Bug fix whit undoing raw modes. 486- More correct error handling. 487- Overall commend improvement. 488- Overall refactor of code. 489 490# Version 0.3.0 491 492This version has some braking changes check [upgrade manual](UPGRADE%20Manual.md) for more information about what is changed. 493I think you should not switch to version `0.3.0` if you aren't going to use the AlternateScreen feature. 494Because you will have some work to get to the new version of crossterm depending on your situation. 495 496Some Features crossterm 0.3.0 497- Alternate Screen for windows and unix systems. 498- Raw screen for unix and windows systems [Issue 5](https://github.com/crossterm-rs/crossterm/issues/5).. 499- Hiding an showing the cursor. 500- Control over blinking of the terminal cursor (only some terminals are supporting this). 501- The terminal state will be set to its original state when process ends [issue7](https://github.com/crossterm-rs/crossterm/issues/7). 502- exit the current process. 503 504## Alternate screen 505 506This create supports alternate screen for both windows and unix systems. You can use 507 508*Nix style applications often utilize an alternate screen buffer, so that they can modify the entire contents of the buffer, without affecting the application that started them. 509The alternate buffer is exactly the dimensions of the window, without any scrollback region. 510For an example of this behavior, consider when vim is launched from bash. 511Vim uses the entirety of the screen to edit the file, then returning to bash leaves the original buffer unchanged. 512 513I Highly recommend you to check the `examples/program_examples/first_depth_search` for seeing this in action. 514 515## Raw screen 516 517This crate now supports raw screen for both windows and unix systems. 518What exactly is raw state: 519- No line buffering. 520 Normally the terminals uses line buffering. This means that the input will be send to the terminal line by line. 521 With raw mode the input will be send one byte at a time. 522- Input 523 All input has to be written manually by the programmer. 524- Characters 525 The characters are not processed by the terminal driver, but are sent straight through. 526 Special character have no meaning, like backspace will not be interpret as backspace but instead will be directly send to the terminal. 527With these modes you can easier design the terminal screen. 528 529## Some functionalities added 530 531- Hiding and showing terminal cursor 532- Enable or disabling blinking of the cursor for unix systems (this is not widely supported) 533- Restoring the terminal to original modes. 534- Added a [wrapper](https://github.com/crossterm-rs/crossterm/blob/master/src/shared/crossterm.rs) for managing all the functionalities of crossterm `Crossterm`. 535- Exit the current running process 536 537## Examples 538Added [examples](https://github.com/crossterm-rs/crossterm/tree/master/examples) for each version of the crossterm version. 539Also added a folder with some [real life examples](https://github.com/crossterm-rs/crossterm/tree/master/examples/program_examples). 540 541## Context 542 543What is the `Context` all about? This `Context` has several reasons why it is introduced into `crossterm version 0.3.0`. 544These points are related to the features like `Alternatescreen` and managing the terminal state. 545 546- At first `Terminal state`: 547 548 Because this is a terminal manipulating library there will be made changes to terminal when running an process. 549 If you stop the process you want the terminal back in its original state. 550 Therefore, I need to track the changes made to the terminal. 551 552- At second `Handle to the console` 553 554 In Rust we can use `stdout()` to get an handle to the current default console handle. 555 For example when in unix systems you want to print something to the main screen you can use the following code: 556 557 write!(std::io::stdout(), "{}", "some text"). 558 559 But things change when we are in alternate screen modes. 560 We can not simply use `stdout()` to get a handle to the alternate screen, since this call returns the current default console handle (handle to mainscreen). 561 562 Because of that we need to store an handle to the current screen. 563 This handle could be used to put into alternate screen modes and back into main screen modes. 564 Through this stored handle Crossterm can execute its command and write on and to the current screen whether it be alternate screen or main screen. 565 566 For unix systems we store the handle gotten from `stdout()` for windows systems that are not supporting ANSI escape codes we store WinApi `HANDLE` struct witch will provide access to the current screen. 567 568So to recap this `Context` struct is a wrapper for a type that manges terminal state changes. 569When this `Context` goes out of scope all changes made will be undone. 570Also is this `Context` is a wrapper for access to the current console screen. 571 572Because Crossterm needs access to the above to types quite often I have chosen to add those two in one struct called `Context` so that this type could be shared throughout library. 573Check this link for more info: [cleanup of rust code](https://stackoverflow.com/questions/48732387/how-can-i-run-clean-up-code-in-a-rust-library). 574More info over writing to alternate screen buffer on windows and unix see this [link](https://github.com/crossterm-rs/crossterm/issues/17) 575 576__Now the user has to pass an context type to the modules of Crossterm like this:__ 577 578 let context = Context::new(); 579 580 let cursor = cursor(&context); 581 let terminal = terminal(&context); 582 let color = color(&context); 583 584Because this looks a little odd I will provide a type withs will manage the `Context` for you. You can call the different modules like the following: 585 586 let crossterm = Crossterm::new(); 587 let color = crossterm.color(); 588 let cursor = crossterm.cursor(); 589 let terminal = crossterm.terminal(); 590 591 592### Alternate screen 593When you want to switch to alternate screen there are a couple of things to keep in mind for it to work correctly. 594First off some code of how to switch to Alternate screen, for more info check the [alternate screen example](https://github.com/crossterm-rs/crossterm/blob/master/examples/alternate_screen.rs). 595 596_Create alternate screen from `Context`_ 597 598 // create context. 599 let context = crossterm::Context::new(); 600 // create instance of Alternatescreen by the given context, this wil also switch to it. 601 let mut screen = crossterm::AlternateScreen::from(context.clone()); 602 // write to the alternate screen. 603 write!(screen, "test"); 604 605_Create alternate screen from `Crossterm`:_ 606 607 // create context. 608 let crossterm = ::crossterm::Crossterm::new(); 609 // create instance of Alternatescreen by the given refrence to crossterm, this wil also switch to it. 610 let mut screen = crossterm::AlternateScreen::from(&crossterm); 611 // write to the alternate screen. 612 write!(screen, "test"); 613 614like demonstrated above, to get the functionalities of `cursor(), color(), terminal()` also working on alternate screen. 615You need to pass it the same `Context` as you have passed to the previous three called functions, 616If you don't use the same `Context` in `cursor(), color(), terminal()` than these modules will be using the main screen and you will not see anything at the alternate screen. If you use the [Crossterm](https://github.com/crossterm-rs/crossterm/blob/master/src/shared/crossterm.rs) type you can get the `Context` from it by calling the crossterm.get_context() whereafter you can create the AlternateScreen from it. 617 618# Version 0.2.2 619 620- Bug see [issue 15](https://github.com/crossterm-rs/crossterm/issues/15) 621 622# Version 0.2.1 623 624- Default ANSI escape codes for windows machines, if windows does not support ANSI switch back to WinApi. 625- method grammar mistake fixed [Issue 3](https://github.com/crossterm-rs/crossterm/issues/3) 626- Some Refactorings in method names see [issue 4](https://github.com/crossterm-rs/crossterm/issues/4) 627- Removed bin reference from crate [Issue 6](https://github.com/crossterm-rs/crossterm/issues/6) 628- Get position unix fixed [issue 8](https://github.com/crossterm-rs/crossterm/issues/8) 629 630# Version 0.2 631 632- 256 color support. 633- Text Attributes like: bold, italic, underscore and crossed word ect. 634- Custom ANSI color code input to set fore- and background color for unix. 635- Storing the current cursor position and resetting to that stored cursor position later. 636- Resizing the terminal. 637