aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/ipc/protobuf_conversion.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-10-27 12:31:02 +0100
committerGitHub <noreply@github.com>2025-10-27 12:31:02 +0100
commit8762f866380360457c84c1e7ce7973f104468f87 (patch)
treeb437ef473578e2120b67e6d96068e05b7cb88511 /zellij-utils/src/ipc/protobuf_conversion.rs
parentMigrate from wasmtime to wasmi (#4449) (diff)
downloadsl0ppij-8762f866380360457c84c1e7ce7973f104468f87.tar.gz
sl0ppij-8762f866380360457c84c1e7ce7973f104468f87.tar.xz
sl0ppij-8762f866380360457c84c1e7ce7973f104468f87.zip
Feature: watcher clients (#4487)
* initial implementation * make Screen aware of watchers - slightly buggy * fix: only render focused tab to watcher * track watcher sizes on Screen * pad watcher output as needed * truncate watcher sizes as needed * render on watcher resize * fix watcher first resize * allow watchers to quit with esc, ctrl-c or ctrl-q * fix: send watcher size on initial connection message * refactor: move padding logic to output * fix watcher rendering after all clients disconnected * fix watcher rendering caching issues * crop watcher cursor when out of bounds * remove watchers cleanly on session close * standardize watcher messages ignoring * add e2e test for watcher functionality * update snapshots * add output tests * rustfmt * cleanups * docs(changelog): add PR
Diffstat (limited to 'zellij-utils/src/ipc/protobuf_conversion.rs')
-rw-r--r--zellij-utils/src/ipc/protobuf_conversion.rs26
1 files changed, 20 insertions, 6 deletions
diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs
index 23c9f201..658c10f3 100644
--- a/zellij-utils/src/ipc/protobuf_conversion.rs
+++ b/zellij-utils/src/ipc/protobuf_conversion.rs
@@ -1,11 +1,12 @@
use crate::{
client_server_contract::client_server_contract::{
- client_to_server_msg, server_to_client_msg, ActionMsg, AttachClientMsg, BackgroundColorMsg,
- CliPipeOutputMsg, ClientExitedMsg, ClientToServerMsg as ProtoClientToServerMsg,
- ColorRegistersMsg, ConfigFileUpdatedMsg, ConnStatusMsg, ConnectedMsg, DetachSessionMsg,
- ExitMsg, ExitReason as ProtoExitReason, FailedToStartWebServerMsg, FirstClientConnectedMsg,
- ForegroundColorMsg, InputMode as ProtoInputMode, KeyMsg, KillSessionMsg, LogErrorMsg,
- LogMsg, QueryTerminalSizeMsg, RenamedSessionMsg, RenderMsg,
+ client_to_server_msg, server_to_client_msg, ActionMsg, AttachClientMsg,
+ AttachWatcherClientMsg, BackgroundColorMsg, CliPipeOutputMsg, ClientExitedMsg,
+ ClientToServerMsg as ProtoClientToServerMsg, ColorRegistersMsg, ConfigFileUpdatedMsg,
+ ConnStatusMsg, ConnectedMsg, DetachSessionMsg, ExitMsg, ExitReason as ProtoExitReason,
+ FailedToStartWebServerMsg, FirstClientConnectedMsg, ForegroundColorMsg,
+ InputMode as ProtoInputMode, KeyMsg, KillSessionMsg, LogErrorMsg, LogMsg,
+ QueryTerminalSizeMsg, RenamedSessionMsg, RenderMsg,
ServerToClientMsg as ProtoServerToClientMsg, StartWebServerMsg, SwitchSessionMsg,
TerminalPixelDimensionsMsg, TerminalResizeMsg, UnblockCliPipeInputMsg,
UnblockInputThreadMsg, WebServerStartedMsg,
@@ -68,6 +69,11 @@ impl From<ClientToServerMsg> for ProtoClientToServerMsg {
pane_to_focus: pane_to_focus.map(|p| p.into()),
is_web_client,
}),
+ ClientToServerMsg::AttachWatcherClient { terminal_size } => {
+ client_to_server_msg::Message::AttachWatcherClient(AttachWatcherClientMsg {
+ terminal_size: Some(terminal_size.into()),
+ })
+ },
ClientToServerMsg::Action {
action,
terminal_id,
@@ -177,6 +183,14 @@ impl TryFrom<ProtoClientToServerMsg> for ClientToServerMsg {
is_web_client: attach.is_web_client,
})
},
+ Some(client_to_server_msg::Message::AttachWatcherClient(attach_watcher)) => {
+ Ok(ClientToServerMsg::AttachWatcherClient {
+ terminal_size: attach_watcher
+ .terminal_size
+ .ok_or_else(|| anyhow::anyhow!("Missing terminal_size"))?
+ .try_into()?,
+ })
+ },
Some(client_to_server_msg::Message::Action(action)) => Ok(ClientToServerMsg::Action {
action: action
.action