Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
sent exit key over channel as well
  • Loading branch information
TimonPost committed Dec 25, 2019
commit 885ec99dcb5bca9c883c515d52faaf6a7d67156d
4 changes: 3 additions & 1 deletion src/event/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ impl Events {
loop {
// poll for tick rate duration, if no event, sent tick event.
if event::poll(config.tick_rate).unwrap() {

if let event::Event::Key(key) = event::read().unwrap() {
let key = Key::from(key);

event_tx.send(Event::Input(key)).unwrap();

if key == config.exit_key {
return;
}
event_tx.send(Event::Input(key)).unwrap();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ fn main() -> Result<(), failure::Error> {
if key == Key::Ctrl('c') {
disable_raw_mode()?;
let mut stdout = io::stdout();
execute!(stdout, LeaveAlternateScreen, DisableMouseCapture)?;
execute!(stdout, LeavefAlternateScreen, DisableMouseCapture)?;
break;
}

Expand Down