From 28aeeda824ca83a479bac720f167da7d59b73e56 Mon Sep 17 00:00:00 2001 From: Andy Lok Date: Wed, 9 Oct 2024 21:50:02 +0800 Subject: [PATCH] Fix external printer don't print until key press (#840) --- src/engine.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index c3427673..21595214 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -718,6 +718,13 @@ impl Reedline { let mut latest_resize = None; loop { + // There could be multiple events queued up! + // pasting text, resizes, blocking this thread (e.g. during debugging) + // We should be able to handle all of them as quickly as possible without causing unnecessary output steps. + if !event::poll(Duration::from_millis(POLL_WAIT))? { + break; + } + match event::read()? { Event::Resize(x, y) => { latest_resize = Some((x, y)); @@ -746,13 +753,6 @@ impl Reedline { } } } - - // There could be multiple events queued up! - // pasting text, resizes, blocking this thread (e.g. during debugging) - // We should be able to handle all of them as quickly as possible without causing unnecessary output steps. - if !event::poll(Duration::from_millis(POLL_WAIT))? { - break; - } } if let Some((x, y)) = latest_resize {