Open hasezoey opened 4 months ago
slight update a day later: updated the script as i had noticed that the key events were only going to the components directly, not returned from .poll
; this does not change result though that termion
is still blocking
Description
As i discovered in #76, the current
termion
key / eventlistener
is blocking, even though thePoll
trait explicitly says the function should not be blocking.This effectively means that anyone wanting to use the
termion
backend and one custom port OR rely on a tick is basically unable to do so reliably.Steps to reproduce
termion
backendReproduction script
```rs extern crate tuirealm; use std::thread; use std::time::Duration; use tui::layout::Rect; use tuirealm::application::PollStrategy; use tuirealm::command::{Cmd, CmdResult}; use tuirealm::terminal::TerminalBridge; use tuirealm::{Application, AttrValue, Attribute, Component, Event, EventListenerCfg, Frame, MockComponent, NoUserEvent, Props, State, Sub, SubClause, SubEventClause, Update}; #[derive(Debug, PartialEq)] pub enum Msg {} #[derive(Debug, Eq, PartialEq, Clone, Hash)] pub enum Id { FIRST } pub struct Model { pub app: ApplicationLog output + some tuirealm inner logs
Note that this is the output over multiple seconds, where a tick should happen every second ```txt LOOP TERMION WAIT After Tick After Tick After Tick After Tick After Tick After Tick After Tick After Tick After Tick After Tick ``` Note that there is no `Message: Tick`Git Diff
```diff diff --git a/Cargo.toml b/Cargo.toml index 17cd154..a4ea2f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,3 +48,7 @@ path = "examples/demo/demo.rs" [[example]] name = "user-events" path = "examples/user_events/user_events.rs" + +[[example]] +name = "termion-test" +path = "examples/demo copy/termion-test.rs" diff --git a/examples/demo copy/termion-test.rs b/examples/demo copy/termion-test.rs new file mode 100644 index 0000000..2d815a0 --- /dev/null +++ b/examples/demo copy/termion-test.rs @@ -0,0 +1,127 @@ +extern crate tuirealm; + +use std::thread; +use std::time::Duration; + +use tui::layout::Rect; +use tuirealm::application::PollStrategy; +use tuirealm::command::{Cmd, CmdResult}; +use tuirealm::terminal::TerminalBridge; +use tuirealm::{Application, AttrValue, Attribute, Component, Event, EventListenerCfg, Frame, MockComponent, NoUserEvent, Props, State, Sub, SubClause, SubEventClause, Update}; + +#[derive(Debug, PartialEq)] +pub enum Msg {} + +#[derive(Debug, Eq, PartialEq, Clone, Hash)] +pub enum Id { + FIRST +} + +pub struct Model { + pub app: Applicationcmd:
cargo run --example=termion-test --no-default-features --features=tui,termion
Expected behaviour
termion
to not be blockingEnvironment
Additional information
Also from what i can tell,
termion
does not provide any way to do this non-blockingly, either requiring to be completely removed or be put into a separate thread