Cursive 0.16.1

This commit is contained in:
Alexandre Bury 2021-01-19 09:57:53 -08:00
parent 848ab341e9
commit 58718824fa
3 changed files with 11 additions and 8 deletions

View File

@ -8,7 +8,7 @@ license = "MIT"
name = "cursive_core" name = "cursive_core"
readme = "Readme.md" readme = "Readme.md"
repository = "https://github.com/gyscos/cursive" repository = "https://github.com/gyscos/cursive"
version = "0.2.2-alpha.0" version = "0.2.1"
edition = "2018" edition = "2018"
[package.metadata.docs.rs] [package.metadata.docs.rs]

View File

@ -8,14 +8,14 @@ license = "MIT"
name = "cursive" name = "cursive"
readme = "../Readme.md" readme = "../Readme.md"
repository = "https://github.com/gyscos/cursive" repository = "https://github.com/gyscos/cursive"
version = "0.16.1-alpha.0" version = "0.16.1"
edition = "2018" edition = "2018"
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = ["unstable_scroll", "markdown", "toml"] features = ["unstable_scroll", "markdown", "toml"]
[dependencies] [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" crossbeam-channel = "0.5"
cfg-if = "1" cfg-if = "1"
wasmer_enumset = "1" wasmer_enumset = "1"

View File

@ -230,8 +230,8 @@ impl Backend {
queue!(self.stdout_mut(), SetAttribute(attr)).unwrap(); queue!(self.stdout_mut(), SetAttribute(attr)).unwrap();
} }
fn map_key(&mut self, event: CEvent) -> Event { fn map_key(&mut self, event: CEvent) -> Option<Event> {
match event { Some(match event {
CEvent::Key(key_event) => translate_event(key_event), CEvent::Key(key_event) => translate_event(key_event),
CEvent::Mouse(CMouseEvent { CEvent::Mouse(CMouseEvent {
kind, kind,
@ -251,7 +251,7 @@ impl Backend {
MouseEvent::Hold(translate_button(button)) MouseEvent::Hold(translate_button(button))
} }
MouseEventKind::Moved => { MouseEventKind::Moved => {
unreachable!("Not tracking mouse move."); return None;
} }
MouseEventKind::ScrollDown => MouseEvent::WheelDown, MouseEventKind::ScrollDown => MouseEvent::WheelDown,
MouseEventKind::ScrollUp => MouseEvent::WheelUp, MouseEventKind::ScrollUp => MouseEvent::WheelUp,
@ -264,7 +264,7 @@ impl Backend {
} }
} }
CEvent::Resize(_, _) => Event::WindowResize, CEvent::Resize(_, _) => Event::WindowResize,
} })
} }
} }
@ -287,7 +287,10 @@ impl backend::Backend for Backend {
fn poll_event(&mut self) -> Option<Event> { fn poll_event(&mut self) -> Option<Event> {
match poll(Duration::from_millis(1)) { match poll(Duration::from_millis(1)) {
Ok(true) => match read() { 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), Err(e) => panic!("{:?}", e),
}, },
_ => None, _ => None,