Merge branch 'master' into development

This commit is contained in:
TimonPost 2018-09-21 21:36:31 +02:00
commit 9bda408e43
7 changed files with 13 additions and 38 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "crossterm" name = "crossterm"
version = "0.4.0" version = "0.4.1"
authors = ["T. Post"] authors = ["T. Post"]
description = "An crossplatform terminal library for manipulating terminals." description = "An crossplatform terminal library for manipulating terminals."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/TimonPost/crossterm"

View File

@ -32,7 +32,7 @@ This crate supports all unix and windows terminals down to windows 7 (not all te
## Getting Started ## Getting Started
This documentation is only for Crossterm version `0.4.0` if you have an older version of Crossterm I suggest you check the [Upgrade Manual](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) for more information about how to upgrade to a newer version. This documentation is only for Crossterm version `0.4.*` if you have an older version of Crossterm I suggest you check the [Upgrade Manual](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) for more information about how to upgrade to a newer version.
Also check out the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folders which detailed examples for all functionality of this crate. Also check out the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) folders which detailed examples for all functionality of this crate.

View File

@ -1,3 +1,6 @@
# Bug fix crossterm to 0.4.1
- Fixed resizing of ansi terminal with and height where in the wrong order.
# Features / Fixes in crossterm 0.4.0 # Features / Fixes in crossterm 0.4.0
- Input support (read_line, read_char, read_async, read_until_async) - Input support (read_line, read_char, read_async, read_until_async)
- Styling module improved - Styling module improved

View File

@ -13,34 +13,24 @@ pub struct AnsiOutput {
} }
impl IStdout for AnsiOutput { impl IStdout for AnsiOutput {
fn write_str(&self, string: &str) -> io::Result<usize> { fn write_str(&self, string: &str) -> io::Result<usize> {
let out = &self.handle; let out = &self.handle;
let mut handle = out.lock(); let mut handle = out.lock();
write!(handle, "{}", string)?; let amt = handle.write(string.as_bytes())?;
handle.flush(); handle.flush()?;
Ok(0) Ok(amt)
} }
fn write(&self, buf: &[u8]) -> io::Result<usize> { fn write(&self, buf: &[u8]) -> io::Result<usize> {
let out = &self.handle; let out = &self.handle;
let mut handle = out.lock(); let mut handle = out.lock();
handle.write(buf)?; handle.write(buf)
Ok(0)
} }
fn flush(&self) -> io::Result<()> { fn flush(&self) -> io::Result<()> {
let out = &self.handle; let out = &self.handle;
let mut handle = out.lock(); let mut handle = out.lock();
handle.flush(); handle.flush()
Ok(())
}
fn as_any(&self) -> &Any {
self
}
fn as_any_mut(&mut self) -> &mut Any {
self
} }
} }

View File

@ -33,7 +33,4 @@ trait IStdout {
fn write(&self, buf: &[u8]) -> io::Result<usize>; fn write(&self, buf: &[u8]) -> io::Result<usize>;
/// Flush the current output. /// Flush the current output.
fn flush(&self) -> io::Result<()>; fn flush(&self) -> io::Result<()>;
fn as_any(&self) -> &Any;
fn as_any_mut(&mut self) -> &mut Any;
} }

View File

@ -67,13 +67,6 @@ impl TerminalOutput {
pub fn write_buf(&self, buf: &[u8]) -> io::Result<usize> { pub fn write_buf(&self, buf: &[u8]) -> io::Result<usize> {
self.stdout.write(buf) self.stdout.write(buf)
} }
pub fn as_any(&self) -> &Any {
self.stdout.as_any()
}
pub fn as_any_mut(&mut self) -> &mut Any {
self.stdout.as_any_mut()
}
} }
impl Default for TerminalOutput impl Default for TerminalOutput

View File

@ -33,14 +33,6 @@ impl IStdout for WinApiOutput {
fn flush(&self) -> io::Result<()> { fn flush(&self) -> io::Result<()> {
Ok(()) Ok(())
} }
fn as_any(&self) -> &Any {
self
}
fn as_any_mut(&mut self) -> &mut Any {
self
}
} }
unsafe impl Send for WinApiOutput {} unsafe impl Send for WinApiOutput {}