Fix examples on windows (#775)
This commit is contained in:
parent
03c25178af
commit
923aaf517b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
|
use crossterm::event::KeyEventKind;
|
||||||
pub use crossterm::{
|
pub use crossterm::{
|
||||||
cursor,
|
cursor,
|
||||||
event::{self, Event, KeyCode, KeyEvent},
|
event::{self, Event, KeyCode, KeyEvent},
|
||||||
@ -61,7 +62,10 @@ where
|
|||||||
'3' => test::attribute::run(w)?,
|
'3' => test::attribute::run(w)?,
|
||||||
'4' => test::event::run(w)?,
|
'4' => test::event::run(w)?,
|
||||||
'5' => test::synchronized_output::run(w)?,
|
'5' => test::synchronized_output::run(w)?,
|
||||||
'q' => break,
|
'q' => {
|
||||||
|
execute!(w, cursor::SetCursorStyle::DefaultUserShape).unwrap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -80,7 +84,9 @@ pub fn read_char() -> Result<char> {
|
|||||||
loop {
|
loop {
|
||||||
if let Ok(Event::Key(KeyEvent {
|
if let Ok(Event::Key(KeyEvent {
|
||||||
code: KeyCode::Char(c),
|
code: KeyCode::Char(c),
|
||||||
..
|
kind: KeyEventKind::Press,
|
||||||
|
modifiers: _,
|
||||||
|
state: _,
|
||||||
})) = event::read()
|
})) = event::read()
|
||||||
{
|
{
|
||||||
return Ok(c);
|
return Ok(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user