From 4f4b26b2978fa1f665764a84013aaca1035d7d9d Mon Sep 17 00:00:00 2001 From: Mikael Mello Date: Sun, 29 Sep 2024 16:46:20 -0700 Subject: [PATCH 1/2] Update to latest version of crossterm --- inquire/Cargo.toml | 6 +++--- inquire/src/terminal/crossterm.rs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/inquire/Cargo.toml b/inquire/Cargo.toml index 278de5a..d63720a 100644 --- a/inquire/Cargo.toml +++ b/inquire/Cargo.toml @@ -32,8 +32,8 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -crossterm = { version = "0.25", optional = true } -termion = { version = "2.0", optional = true } +crossterm = { version = "0.28.1", optional = true } +termion = { version = "4.0", optional = true } console = { version = "0.15", optional = true, features = [ "windows-console-colors", ] } @@ -52,7 +52,7 @@ unicode-width = "0.1" fxhash = "0.2" [dev-dependencies] -rstest = "0.18.2" +rstest = "0.22.0" chrono = { version = "0.4" } [[example]] diff --git a/inquire/src/terminal/crossterm.rs b/inquire/src/terminal/crossterm.rs index 3e781b5..e5d2a78 100644 --- a/inquire/src/terminal/crossterm.rs +++ b/inquire/src/terminal/crossterm.rs @@ -2,7 +2,7 @@ use std::io::{stderr, Result, Stderr, Write}; use crossterm::{ cursor, - event::{self, KeyCode, KeyEvent, KeyModifiers}, + event::{self, KeyCode, KeyEvent, KeyEventKind, KeyModifiers}, queue, style::{Attribute, Color, Print, SetAttribute, SetBackgroundColor, SetForegroundColor}, terminal::{self, ClearType}, @@ -38,7 +38,9 @@ impl InputReader for CrosstermKeyReader { fn read_key(&mut self) -> InquireResult { loop { if let event::Event::Key(key_event) = event::read()? { - return Ok(key_event.into()); + if KeyEventKind::Press == key_event.kind { + return Ok(key_event.into()); + } } } } From 6f2715994f84162c208eb10a61c975ef18e543c9 Mon Sep 17 00:00:00 2001 From: Russ Christensen Date: Fri, 18 Oct 2024 10:06:30 -0700 Subject: [PATCH 2/2] Put back --- inquire/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inquire/Cargo.toml b/inquire/Cargo.toml index d63720a..76893cd 100644 --- a/inquire/Cargo.toml +++ b/inquire/Cargo.toml @@ -33,7 +33,7 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] crossterm = { version = "0.28.1", optional = true } -termion = { version = "4.0", optional = true } +termion = { version = "2.0", optional = true } console = { version = "0.15", optional = true, features = [ "windows-console-colors", ] }