Skip to content

Commit

Permalink
Fix external printer don't print until key press (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
andylokandy authored Oct 9, 2024
1 parent 871075e commit 28aeeda
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 28aeeda

Please sign in to comment.