diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-17 12:27:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-17 12:27:00 -0400 |
commit | d47cb39c8fb3e60bf47690626f5287e3cd981c8c (patch) | |
tree | 42a01012d0bbd22ff271697dc72646404b604cef /src/cmd/stream.rs | |
parent | 61c8fb0a8d6460aff45ed454cfb2b0a5e37a1a89 (diff) | |
download | teleterm-d47cb39c8fb3e60bf47690626f5287e3cd981c8c.tar.gz teleterm-d47cb39c8fb3e60bf47690626f5287e3cd981c8c.zip |
ensure resize handling works everywhere
previously record wasn't getting resize events because they were being
handled in the client (which record doesn't use)
Diffstat (limited to 'src/cmd/stream.rs')
-rw-r--r-- | src/cmd/stream.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cmd/stream.rs b/src/cmd/stream.rs index eba26bb..a9eea1b 100644 --- a/src/cmd/stream.rs +++ b/src/cmd/stream.rs @@ -180,7 +180,7 @@ struct StreamSession< S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static, > { client: crate::client::Client<S>, - process: crate::process::Process<crate::async_stdin::Stdin>, + process: crate::resize::ResizingProcess<crate::async_stdin::Stdin>, stdout: tokio::io::Stdout, buffer: crate::term::Buffer, sent_local: usize, @@ -209,7 +209,9 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> // let input = tokio::io::stdin(); let input = crate::async_stdin::Stdin::new(); - let process = crate::process::Process::new(cmd, args, input); + let process = crate::resize::ResizingProcess::new( + crate::process::Process::new(cmd, args, input), + ); Self { client, @@ -268,11 +270,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> self.connected = false; Ok(crate::component_future::Async::DidWork) } - crate::client::Event::Start(size) => { - self.process.resize(size); - Ok(crate::component_future::Async::DidWork) - } - crate::client::Event::Connect() => { + crate::client::Event::Connect => { self.connected = true; self.sent_remote = 0; Ok(crate::component_future::Async::DidWork) @@ -284,10 +282,6 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> self.client.reconnect(); Ok(crate::component_future::Async::DidWork) } - crate::client::Event::Resize(size) => { - self.process.resize(size); - Ok(crate::component_future::Async::DidWork) - } }, Ok(futures::Async::Ready(None)) => { // the client should never exit on its own @@ -307,7 +301,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> &mut self, ) -> crate::component_future::Poll<(), Error> { match self.process.poll()? { - futures::Async::Ready(Some(e)) => { + futures::Async::Ready(Some(crate::resize::Event::Process(e))) => { match e { crate::process::Event::CommandStart(..) => { if self.raw_screen.is_none() { @@ -316,7 +310,6 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> .context(crate::error::ToRawMode)?, ); } - self.process.resize(crate::term::Size::get()?); } crate::process::Event::CommandExit(..) => { self.done = true; @@ -327,6 +320,13 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static> } Ok(crate::component_future::Async::DidWork) } + futures::Async::Ready(Some(crate::resize::Event::Resize( + size, + ))) => { + self.client + .send_message(crate::protocol::Message::resize(&size)); + Ok(crate::component_future::Async::DidWork) + } futures::Async::Ready(None) => { if !self.done { unreachable!() |