From bf9cc201244946496b4d950046bf7edcc4892994 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Thu, 28 May 2026 04:11:56 +0300 Subject: fix: preserve live handoff terminal state --- src/handoff_runtime.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/handoff_runtime.rs (limited to 'src/handoff_runtime.rs') diff --git a/src/handoff_runtime.rs b/src/handoff_runtime.rs new file mode 100644 index 00000000..331cff07 --- /dev/null +++ b/src/handoff_runtime.rs @@ -0,0 +1,36 @@ +#[cfg(unix)] +use serde::{Deserialize, Serialize}; + +#[cfg(unix)] +#[derive(Debug, Clone, Serialize, Deserialize)] +pub(crate) struct HandoffRuntimeState { + pub pane_id: u32, + pub child_pid: u32, + pub rows: u16, + pub cols: u16, + pub cell_width_px: u32, + pub cell_height_px: u32, + #[serde(default)] + pub keyboard_protocol_flags: u16, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub keyboard_protocol_ansi: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub input_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub initial_history_ansi: Option, +} + +#[cfg(unix)] +impl HandoffRuntimeState { + pub fn with_pane_id(mut self, pane_id: crate::layout::PaneId) -> Self { + self.pane_id = pane_id.raw(); + self + } +} + +#[cfg(unix)] +#[derive(Debug)] +pub(crate) struct ImportedHandoffRuntime { + pub master_fd: std::os::fd::RawFd, + pub state: HandoffRuntimeState, +} -- cgit v1.2.3