From 49d5aa2216b17636768c12c1fa78ae43f532210b Mon Sep 17 00:00:00 2001 From: Russ Christensen Date: Mon, 16 Sep 2024 10:36:47 -0700 Subject: [PATCH] Update to newer Crossterm library --- inquire/Cargo.toml | 2 +- inquire/src/terminal/crossterm.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/inquire/Cargo.toml b/inquire/Cargo.toml index c078dbcc..412f8bf2 100644 --- a/inquire/Cargo.toml +++ b/inquire/Cargo.toml @@ -32,7 +32,7 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] -crossterm = { version = "0.25", 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", diff --git a/inquire/src/terminal/crossterm.rs b/inquire/src/terminal/crossterm.rs index 3d0a9cdc..6c3cc2da 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()); + } } } }