Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external_printer does not print until I press some key #757

Open
tom-code opened this issue Feb 24, 2024 · 0 comments
Open

external_printer does not print until I press some key #757

tom-code opened this issue Feb 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tom-code
Copy link

Platform macOS, linux
Terminal software Apple Terminal.app

Describe the problem you are observing.
Lines printed using external_printer feature are printed only when some key is pressed.

Steps to reproduce

Just run external_printer example.

Problem seems to be caused by change #651

Following change seems to fix issue for me:

diff --git a/src/engine.rs b/src/engine.rs
index e7bcceb..203fd1b 100644
--- a/src/engine.rs
+++ b/src/engine.rs
@@ -695,6 +695,10 @@ impl Reedline {
 
             let mut latest_resize = None;
             loop {
+                #[cfg(feature = "external_printer")]
+                if !event::poll(Duration::from_millis(POLL_WAIT*10))? {
+                    break;
+                }
                 match event::read()? {
                     Event::Resize(x, y) => {
                         latest_resize = Some((x, y));

this undoes solution of #651 , but I tried to limit it to only configuration when external_printer feature is enabled and used POLL_WAIT*10 to wait 100ms instead of 10 to not waste too much cpu.

@tom-code tom-code added the bug Something isn't working label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant