diff --git a/docs/ReleaseNotesVersion 0.2.0.md b/docs/ReleaseNotesVersion 0.2.0.md deleted file mode 100644 index a184a63..0000000 --- a/docs/ReleaseNotesVersion 0.2.0.md +++ /dev/null @@ -1,7 +0,0 @@ -## Features crossterm 0.2 - -- 256 color support. -- Text Attributes like: bold, italic, underscore and crossed word ect. -- Custom ANSI color code input to set fore- and background color for unix. -- Storing the current cursor position and resetting to that stored cursor position later. -- Resizing the terminal. \ No newline at end of file diff --git a/docs/ReleaseNotesVersion 0.2.1.md b/docs/ReleaseNotesVersion 0.2.1.md deleted file mode 100644 index 3d6f9ae..0000000 --- a/docs/ReleaseNotesVersion 0.2.1.md +++ /dev/null @@ -1,7 +0,0 @@ -## fixes in crossterm 0.2.1 - -- Default ANSI escape codes for windows machines, if windows does not support ANSI switch back to WinApi. -- method grammar mistake fixed [Issue 3](https://github.com/TimonPost/crossterm/issues/3) -- Some Refactorings in method names see [issue 4](https://github.com/TimonPost/crossterm/issues/4) -- Removed bin reference from crate [Issue 6](https://github.com/TimonPost/crossterm/issues/6) -- Get position unix fixed [issue 8](https://github.com/TimonPost/crossterm/issues/8) \ No newline at end of file diff --git a/docs/ReleaseNotesVersion 0.2.2.md b/docs/ReleaseNotesVersion 0.2.2.md deleted file mode 100644 index 23c5fc6..0000000 --- a/docs/ReleaseNotesVersion 0.2.2.md +++ /dev/null @@ -1,2 +0,0 @@ -## fixes in crossterm 0.2.2 -- Bug see [issue 15](https://github.com/TimonPost/crossterm/issues/15) \ No newline at end of file diff --git a/docs/ReleaseNotesVersion 0.3.0.md b/docs/ReleaseNotesVersion 0.3.0.md index 807701b..68fbe3f 100644 --- a/docs/ReleaseNotesVersion 0.3.0.md +++ b/docs/ReleaseNotesVersion 0.3.0.md @@ -1,7 +1,16 @@ +# Features / Fixes in crossterm 0.4.0 +- Input support (read_line, read_char, read_async, read_until_async) +- Styling module improved +- This create supports multithreading (`Send`) +- Performance enhancements: removed mutexes, removed state manager, removed context type removed unnecessarily RC types. +- Bug fix resetting console color. +- Bug fix whit undoing raw modes. + +# Features in crossterm 0.3.0 + This version has some braking changes check [upgrade manual](UPGRADE%20Manual.md) for more information about what is changed. I think you should not switch to version `0.3.0` if you aren't going to use the AlternateScreen feature. Because you will have some work to get to the new version of crossterm depending on your situation. -But if this is the firsttime you are using this crate I highly recommend you to switch to the new version `0.3.0`. Some Features crossterm 0.3.0 - Alternate Screen for windows and unix systems. @@ -121,3 +130,22 @@ _Create alternate screen from `Crossterm`:_ like demonstrated above, to get the functionalities of `cursor(), color(), terminal()` also working on alternate screen. You need to pass it the same `Context` as you have passed to the previous three called functions, If 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/TimonPost/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. + +# Fixes in crossterm 0.2.2 +- Bug see [issue 15](https://github.com/TimonPost/crossterm/issues/15) + +# Fixes in crossterm 0.2.1 + +- Default ANSI escape codes for windows machines, if windows does not support ANSI switch back to WinApi. +- method grammar mistake fixed [Issue 3](https://github.com/TimonPost/crossterm/issues/3) +- Some Refactorings in method names see [issue 4](https://github.com/TimonPost/crossterm/issues/4) +- Removed bin reference from crate [Issue 6](https://github.com/TimonPost/crossterm/issues/6) +- Get position unix fixed [issue 8](https://github.com/TimonPost/crossterm/issues/8) + +# Features crossterm 0.2 + +- 256 color support. +- Text Attributes like: bold, italic, underscore and crossed word ect. +- Custom ANSI color code input to set fore- and background color for unix. +- Storing the current cursor position and resetting to that stored cursor position later. +- Resizing the terminal. diff --git a/docs/UpgradeManual.md b/docs/UpgradeManual.md index ea45150..c5fa84b 100644 --- a/docs/UpgradeManual.md +++ b/docs/UpgradeManual.md @@ -1,3 +1,90 @@ +## Upgrade crossterm to 0.4.0 + +***WARNING*** + +This new version contains some cool features but to get those features working I needed to add some user API braking changes. +I really did not want to do this but it had to be done for some reasons. + +#### 1. You need to pass a reference to an `Screen` to the modules: `cursor(), color(), terminal()` + +``` +use crossterm::terminal::terminal; +use crossterm::cursor::cursor; +use crossterm::style::color; + +/// Old situation +use crossterm::Context; + +let context: Rc = Context::new(); + +let cursor = cursor(&context); +let terminal = terminal(&context); +let color = color(&context); + +/// new situation +use crossterm::Context; + +let screen: Screen = Screen::default(); + +let cursor = cursor(&screen); +let terminal = terminal(&screen); +let color = color(&screen); +``` + +#### 2. The `::crossterm::Crossterm::paint()` function does not exits anymore like before: + +Instead you could do it like the following: + +``` +use crossterm::Crossterm; +use crossterm::style::{Color, input, style}; + +// 1: use the `Crossterm` type +let crossterm = Crossterm::new(); +let styled_object = crossterm.style("Red font on Black background").with(Color::Red).on(Color::Black); +styled_object.paint(&screen); + +// 2: use the `Terminal` type +let styled_object = style("Red font on Black background").with(Color::Red).on(Color::Black); +styled_object.paint(&screen); + +``` + +#### 3. Alternate Screen and Raw Screen +Also I have changed how the alternate and raw screen are working. + +``` +// could not be used any more +::crossterm::AlternateScreen::from(); +// cannot put any Write into raw mode. +::std::io::Write::into_raw_mode() +``` + +This now should be done with the `Screen` type like: + +``` +use crossterm::Screen; +use crossterm::cursor::cursor; + +// this will create a default screen. +let screen = Screen::default(); + +// this will create a new screen with raw modes enabled. +let screen = Screen::new(true); + +// false specifies whether the alternate screen should be in raw modes. +if let Ok(alternate) = screen.enable_alternate_modes(false) +{ + let cursor = cursor(&alternate.screen); +} +``` + +#### Other +- ::crossterm::Crossterm::write() is gone. +- Context type is removed +- StateManager is removed +- ScreenManager type is renamed to Stdout. + ## Upgrade crossterm 0.2.1 to 0.3.0 ***WARNING*** @@ -12,6 +99,7 @@ First thing that has changed is that you need to pass a reference to an `Rc