From 58718824fabf00fa43ccc3e9a0796100f3ea2c05 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Tue, 19 Jan 2021 09:57:53 -0800 Subject: [PATCH] Cursive 0.16.1 --- cursive-core/Cargo.toml | 2 +- cursive/Cargo.toml | 4 ++-- cursive/src/backends/crossterm.rs | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cursive-core/Cargo.toml b/cursive-core/Cargo.toml index 272edd1..b24883c 100644 --- a/cursive-core/Cargo.toml +++ b/cursive-core/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "cursive_core" readme = "Readme.md" repository = "https://github.com/gyscos/cursive" -version = "0.2.2-alpha.0" +version = "0.2.1" edition = "2018" [package.metadata.docs.rs] diff --git a/cursive/Cargo.toml b/cursive/Cargo.toml index f037e9b..b144324 100644 --- a/cursive/Cargo.toml +++ b/cursive/Cargo.toml @@ -8,14 +8,14 @@ license = "MIT" name = "cursive" readme = "../Readme.md" repository = "https://github.com/gyscos/cursive" -version = "0.16.1-alpha.0" +version = "0.16.1" edition = "2018" [package.metadata.docs.rs] features = ["unstable_scroll", "markdown", "toml"] [dependencies] -cursive_core = { path = "../cursive-core", version= "^0.2.2-alpha.0"} +cursive_core = { path = "../cursive-core", version= "0.2.1"} crossbeam-channel = "0.5" cfg-if = "1" wasmer_enumset = "1" diff --git a/cursive/src/backends/crossterm.rs b/cursive/src/backends/crossterm.rs index 49f052d..63957cb 100644 --- a/cursive/src/backends/crossterm.rs +++ b/cursive/src/backends/crossterm.rs @@ -230,8 +230,8 @@ impl Backend { queue!(self.stdout_mut(), SetAttribute(attr)).unwrap(); } - fn map_key(&mut self, event: CEvent) -> Event { - match event { + fn map_key(&mut self, event: CEvent) -> Option { + Some(match event { CEvent::Key(key_event) => translate_event(key_event), CEvent::Mouse(CMouseEvent { kind, @@ -251,7 +251,7 @@ impl Backend { MouseEvent::Hold(translate_button(button)) } MouseEventKind::Moved => { - unreachable!("Not tracking mouse move."); + return None; } MouseEventKind::ScrollDown => MouseEvent::WheelDown, MouseEventKind::ScrollUp => MouseEvent::WheelUp, @@ -264,7 +264,7 @@ impl Backend { } } CEvent::Resize(_, _) => Event::WindowResize, - } + }) } } @@ -287,7 +287,10 @@ impl backend::Backend for Backend { fn poll_event(&mut self) -> Option { match poll(Duration::from_millis(1)) { Ok(true) => match read() { - Ok(event) => Some(self.map_key(event)), + Ok(event) => match self.map_key(event) { + Some(event) => Some(event), + None => return self.poll_event(), + }, Err(e) => panic!("{:?}", e), }, _ => None,