Skip to content

Commit

Permalink
Windows duplicate keys (#151)
Browse files Browse the repository at this point in the history
Resolves #136 

---------

Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
  • Loading branch information
ViniciusAndr and aome510 authored Mar 2, 2023
1 parent b6fbdf2 commit 9e93b7a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion spotify_player/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,17 @@ pub fn start_event_handler(state: SharedState, client_pub: flume::Sender<ClientR
let _enter = tracing::info_span!("terminal_event", event = ?event).entered();
if let Err(err) = match event {
crossterm::event::Event::Mouse(event) => handle_mouse_event(event, &client_pub, &state),
crossterm::event::Event::Key(event) => handle_key_event(event, &client_pub, &state),
crossterm::event::Event::Key(event) => {
if event.kind == crossterm::event::KeyEventKind::Press {
// only handle key press event to avoid handling a key event multiple times
// context:
// - https://github.com/crossterm-rs/crossterm/issues/752
// - https://github.com/aome510/spotify-player/issues/136
handle_key_event(event, &client_pub, &state)
} else {
Ok(())
}
}
_ => Ok(()),
} {
tracing::error!("Failed to handle event: {err:#}");
Expand Down

0 comments on commit 9e93b7a

Please sign in to comment.