Skip to content

Commit

Permalink
Fixes a bug on windows (atuinsh#780)
Browse files Browse the repository at this point in the history
* Fixes the windows double input issue instead of the patchy way

* clippy allow
  • Loading branch information
YummyOreo authored Mar 14, 2023
1 parent 148730e commit 88deec3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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! {
Expand Down

0 comments on commit 88deec3

Please sign in to comment.