Fixes a bug on windows (#780)

* Fixes the windows double input issue instead of the patchy way

* clippy allow
This commit is contained in:
YummyOreo 2023-03-14 06:47:24 -05:00 committed by GitHub
parent 148730edf3
commit 88deec31c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,12 +96,17 @@ impl State {
None
}
#[allow(clippy::too_many_lines)]
fn handle_key_input(
&mut self,
settings: &Settings,
input: &KeyEvent,
len: usize,
) -> Option<usize> {
if input.kind == event::KeyEventKind::Release {
return None;
}
let ctrl = input.modifiers.contains(KeyModifiers::CONTROL);
let alt = input.modifiers.contains(KeyModifiers::ALT);
match input.code {
@ -483,13 +488,6 @@ pub async fn history(
let initial_input = app.input.as_str().to_owned();
let initial_filter_mode = app.filter_mode;
{
// We do this because windows does double inputs and captures the `Enter` when running a
// command
#[cfg(target_os = "windows")]
let _ = event::read();
};
let event_ready = tokio::task::spawn_blocking(|| event::poll(Duration::from_millis(250)));
tokio::select! {