From d6f5c0e0fa2c363c6c707e2af9fbe5cc3a6952c3 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Fri, 4 Oct 2019 13:16:48 -0700 Subject: [PATCH] Update crossterm to 0.11 --- CHANGELOG.md | 1 + Cargo.toml | 2 +- src/backend/crossterm.rs | 4 ++-- src/cursive.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a378fc..88f261c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - `cursive::event::AnyCb` changed from `Box<...>` to `&mut ...`, so users of `View::call_on_any` no longer need to box their closures. - Remove `BoxView::squishable`. +- Update crossterm to 0.11 ### API updates diff --git a/Cargo.toml b/Cargo.toml index 9ef77ba..2b66f40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ version = "1.5.3" [dependencies.crossterm] optional = true -version = "0.10.1" +version = "0.11" [target.'cfg(unix)'.dependencies] signal-hook = "0.1.10" diff --git a/src/backend/crossterm.rs b/src/backend/crossterm.rs index 1aecde9..ffae71b 100644 --- a/src/backend/crossterm.rs +++ b/src/backend/crossterm.rs @@ -30,7 +30,7 @@ pub struct Backend { impl Backend { /// Creates a new crossterm backend. - pub fn init() -> std::io::Result> + pub fn init() -> Result, crossterm::ErrorKind> where Self: Sized, { @@ -196,7 +196,7 @@ impl backend::Backend for Backend { } fn screen_size(&self) -> Vec2 { - let size = self.terminal.terminal_size(); + let size = self.terminal.size().unwrap_or((0, 0)); Vec2::from(size) } diff --git a/src/cursive.rs b/src/cursive.rs index 7799739..01d68c1 100644 --- a/src/cursive.rs +++ b/src/cursive.rs @@ -173,7 +173,7 @@ impl Cursive { /// Creates a new Cursive root using a crossterm backend. #[cfg(feature = "crossterm-backend")] - pub fn crossterm() -> std::io::Result { + pub fn crossterm() -> Result { Self::try_new(backend::crossterm::Backend::init) }