You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As i discovered in #76, the current termion key / event listener is blocking, even though the Poll 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
use the termion backend
enable the ticker
fetch all events for a while
observe no events being generated (including no ticks)
Reproduction script
externcrate 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)]pubenumMsg{}#[derive(Debug,Eq,PartialEq,Clone,Hash)]pubenumId{FIRST}pubstructModel{pubapp:Application<Id,Msg,NoUserEvent>,pubterminal:TerminalBridge,}implDefaultforModel{fndefault() -> Self{Self{app:Self::init_app(),terminal:TerminalBridge::new().expect("Cannot initialize terminal"),}}}implModel{fninit_app() -> Application<Id,Msg,NoUserEvent>{let app:Application<Id,Msg,NoUserEvent> = Application::init(EventListenerCfg::default().default_input_listener(Duration::from_millis(20)).poll_timeout(Duration::from_millis(10)).tick_interval(Duration::from_secs(1)),);
app
}}implUpdate<Msg>forModel{fnupdate(&mutself,msg:Option<Msg>) -> Option<Msg>{None}}pubstructLabel{props:Props,}implDefaultforLabel{fndefault() -> Self{Self{props:Props::default(),}}}implMockComponentforLabel{fnview(&mutself,frame:&mutFrame,area:Rect){}fnquery(&self,attr:Attribute) -> Option<AttrValue>{self.props.get(attr)}fnattr(&mutself,attr:Attribute,value:AttrValue){self.props.set(attr, value);}fnstate(&self) -> State{State::None}fnperform(&mutself, _:Cmd) -> CmdResult{CmdResult::None}}implComponent<Msg,NoUserEvent>forLabel{fnon(&mutself,msg:Event<NoUserEvent>) -> Option<Msg>{println!("Message: {:#?}", msg);None}}fnmain(){letmut model = Model::default();// let _ = model.terminal.enter_alternate_screen();// let _ = model.terminal.enable_raw_mode(); // does nothing on termionlet _ = model.app.mount(Id::FIRST,Box::new(Label::default()),vec![Sub::new(SubEventClause::Any,
SubClause::Always,
),
]);loop{// Tickmatch model.app.tick(PollStrategy::Once){Err(err) => {eprintln!("ERROR: {:#?}", err);break;}Ok(messages) => {eprintln!("After Tick");}}
thread::sleep(Duration::from_secs(1));}// let _ = model.terminal.leave_alternate_screen();// let _ = model.terminal.disable_raw_mode();// let _ = model.terminal.clear_screen();}
Log output + some tuirealm inner logs
Note that this is the output over multiple seconds, where a tick should happen every second
LOOP
TERMION WAIT
After Tick
After Tick
After Tick
After Tick
After Tick
After Tick
After Tick
After Tick
After Tick
After Tick
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
The text was updated successfully, but these errors were encountered:
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
Log output + some tuirealm inner logs
Note that this is the output over multiple seconds, where a tick should happen every second
Note that there is no
Message: Tick
Git Diff
cmd:
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 threadThe text was updated successfully, but these errors were encountered: