Fix examples on windows (#775)

This commit is contained in:
lesleyrs 2023-04-07 17:10:56 +02:00 committed by GitHub
parent 03c25178af
commit 923aaf517b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
use std::io::{self, Write};
use crossterm::event::KeyEventKind;
pub use crossterm::{
cursor,
event::{self, Event, KeyCode, KeyEvent},
@ -61,7 +62,10 @@ where
'3' => test::attribute::run(w)?,
'4' => test::event::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 {
if let Ok(Event::Key(KeyEvent {
code: KeyCode::Char(c),
..
kind: KeyEventKind::Press,
modifiers: _,
state: _,
})) = event::read()
{
return Ok(c);