From b61bf9dcf2fa60cd4438f53345e821235f0731f3 Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Tue, 22 Jun 2021 09:02:29 +0530 Subject: [PATCH] Increase poll timeout Ref: https://github.com/sayanarijit/xplr/issues/10 --- src/event_reader.rs | 3 ++- src/runner.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/event_reader.rs b/src/event_reader.rs index 8f44de9..7eea029 100644 --- a/src/event_reader.rs +++ b/src/event_reader.rs @@ -15,9 +15,10 @@ pub fn keep_reading(tx_msg_in: Sender, rx_event_reader: Receiver) { if is_paused { thread::sleep(std::time::Duration::from_millis(200)); - } else if event::poll(std::time::Duration::from_millis(50)).unwrap_or_default() { + } else if event::poll(std::time::Duration::from_millis(150)).unwrap_or_default() { // NOTE: The poll timeout need to stay low, else spawning sub subshell // and start typing immediately will cause panic. + // To reproduce, press `:`, then press and hold `!`. match event::read() { Ok(Event::Key(key)) => { let key = Key::from_event(key); diff --git a/src/runner.rs b/src/runner.rs index 11fafb7..4d7d48b 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -164,7 +164,10 @@ impl Runner { let session_path = app.session_path().to_owned(); term::enable_raw_mode()?; + + // Use a tty to enable piping results let mut stdout = get_tty()?; + // let stdout = io::stdout(); // let mut stdout = stdout.lock(); execute!(stdout, term::EnterAlternateScreen)?;