Fixes a bug on windows (#780)
* Fixes the windows double input issue instead of the patchy way * clippy allow
This commit is contained in:
parent
148730edf3
commit
88deec31c8
1 changed files with 5 additions and 7 deletions
|
@ -96,12 +96,17 @@ impl State {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_lines)]
|
||||||
fn handle_key_input(
|
fn handle_key_input(
|
||||||
&mut self,
|
&mut self,
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
input: &KeyEvent,
|
input: &KeyEvent,
|
||||||
len: usize,
|
len: usize,
|
||||||
) -> Option<usize> {
|
) -> Option<usize> {
|
||||||
|
if input.kind == event::KeyEventKind::Release {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let ctrl = input.modifiers.contains(KeyModifiers::CONTROL);
|
let ctrl = input.modifiers.contains(KeyModifiers::CONTROL);
|
||||||
let alt = input.modifiers.contains(KeyModifiers::ALT);
|
let alt = input.modifiers.contains(KeyModifiers::ALT);
|
||||||
match input.code {
|
match input.code {
|
||||||
|
@ -483,13 +488,6 @@ pub async fn history(
|
||||||
let initial_input = app.input.as_str().to_owned();
|
let initial_input = app.input.as_str().to_owned();
|
||||||
let initial_filter_mode = app.filter_mode;
|
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)));
|
let event_ready = tokio::task::spawn_blocking(|| event::poll(Duration::from_millis(250)));
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|
Loading…
Reference in a new issue