Skip to content

Commit

Permalink
Fix examples on windows (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesleyrs authored Apr 7, 2023
1 parent 03c2517 commit 923aaf5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/interactive-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use std::io::{self, Write};

use crossterm::event::KeyEventKind;
pub use crossterm::{
cursor,
event::{self, Event, KeyCode, KeyEvent},
Expand Down Expand Up @@ -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;
}
_ => {}
};
}
Expand All @@ -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);
Expand Down

0 comments on commit 923aaf5

Please sign in to comment.