| 1 | use serde::{Deserialize, Serialize}; |
| 2 | |
| 3 | // The prompt for the active block. |
| 4 | #[derive(Clone, Default, Deserialize, PartialEq, Eq, Serialize)] |
| 5 | pub enum ActivePrompt { |
| 6 | /// Using the PS1 prompt, which is included in forwarded pty bytes. |
| 7 | #[default] |
| 8 | PS1, |
| 9 | /// JSON serialization of PromptSnapshot |
| 10 | WarpPrompt(String), |
| 11 | } |
| 12 | |
| 13 | /// Override the Debug impl to avoid accidentally leaking sensitive |
| 14 | /// data in logs. |
| 15 | impl std::fmt::Debug for ActivePrompt { |
| 16 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 17 | match self { |
| 18 | Self::PS1 { .. } => f.write_str("ActivePrompt::PS1"), |
| 19 | Self::WarpPrompt(..) => f.write_str("ActivePrompt::WarpPrompt"), |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | // An update to the active block's prompt. |
| 25 | #[derive(Clone, Debug, Deserialize, Serialize)] |
| 26 | pub struct ActivePromptUpdate { |
| 27 | pub active_prompt: ActivePrompt, |
| 28 | /// The event_no of the last OrderedTerminalEvent shared. |
| 29 | pub last_event_no: usize, |
| 30 | } |