Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cotp"
version = "1.2.3"
version = "1.2.4"
authors = ["replydev <[email protected]>"]
edition = "2021"
description = "Trustworthy, encrypted, command-line TOTP/HOTP authenticator app with import functionality."
Expand Down
12 changes: 10 additions & 2 deletions src/interface/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::mpsc;
use std::thread;
use std::time::{Duration, Instant};

use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, MouseEvent};
use crossterm::event::{self, Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent};

use crate::interface::app::AppResult;

Expand Down Expand Up @@ -50,7 +50,15 @@ impl EventHandler {

if event::poll(timeout).expect("no events available") {
match event::read().expect("unable to read event") {
CrosstermEvent::Key(e) => sender.send(Event::Key(e)),
CrosstermEvent::Key(e) => {
// Workaround to fix double input on Windows
// Please check https://github.com/crossterm-rs/crossterm/issues/752
if e.kind == KeyEventKind::Press {
sender.send(Event::Key(e))
} else {
Ok(())
}
}
CrosstermEvent::Mouse(e) => sender.send(Event::Mouse(e)),
CrosstermEvent::Resize(w, h) => sender.send(Event::Resize(w, h)),
CrosstermEvent::FocusGained => sender.send(Event::FocusGained()),
Expand Down