Skip to content

Commit

Permalink
common: fix prompt bug in Windows (crossterm-rs/crossterm#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
Slixe committed Aug 30, 2023
1 parent 3603ab9 commit 7820701
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xelis_common/src/prompt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::io::{Write, stdout, Error as IOError};
use std::num::ParseFloatError;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering, AtomicUsize};
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
use crossterm::event::{self, Event, KeyCode, KeyModifiers, KeyEventKind};
use crossterm::terminal;
use fern::colors::{ColoredLevelConfig, Color};
use tokio::sync::mpsc::{self, UnboundedSender, UnboundedReceiver};
Expand Down Expand Up @@ -157,6 +157,11 @@ impl State {
buffer.push_str(&s);
}
Event::Key(key) => {
// Windows bug - https://github.com/crossterm-rs/crossterm/issues/772
if key.kind != KeyEventKind::Press {
continue;
}

match key.code {
KeyCode::Up => {
let mut buffer = self.user_input.lock()?;
Expand Down

0 comments on commit 7820701

Please sign in to comment.