Add server-owned stacked panes with vertical navigation
This commit is contained in:
+55
-3
@@ -10,7 +10,7 @@ use anyhow::{Context, Result, bail};
|
||||
use bincode::Options;
|
||||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||
|
||||
pub const VERSION: u32 = 2;
|
||||
pub const VERSION: u32 = 3;
|
||||
pub const MAX_MESSAGE_BYTES: usize = 16 * 1024 * 1024;
|
||||
pub type PaneId = u64;
|
||||
pub type TabId = u64;
|
||||
@@ -73,6 +73,43 @@ pub enum ClientMessage {
|
||||
pane: PaneId,
|
||||
name: Option<String>,
|
||||
},
|
||||
/// Insert above/below a pane, or current server focus when omitted.
|
||||
NewStackPane {
|
||||
pane: Option<PaneId>,
|
||||
direction: VerticalDirection,
|
||||
cwd: Option<String>,
|
||||
},
|
||||
/// Expand the adjacent pane in this column, stopping at either end.
|
||||
FocusStackPane {
|
||||
pane: PaneId,
|
||||
direction: VerticalDirection,
|
||||
},
|
||||
/// Navigate from authoritative server focus. Horizontal edges switch tabs.
|
||||
FocusDirection {
|
||||
direction: Direction,
|
||||
},
|
||||
/// Cycle relative to current server focus, preserving repeated key presses.
|
||||
CycleTab {
|
||||
forward: bool,
|
||||
},
|
||||
/// Cycle expanded columns in the current tab, with wraparound.
|
||||
CyclePane {
|
||||
forward: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum VerticalDirection {
|
||||
Up,
|
||||
Down,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum Direction {
|
||||
Left,
|
||||
Right,
|
||||
Up,
|
||||
Down,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
@@ -129,16 +166,31 @@ pub struct Snapshot {
|
||||
pub revision: u64,
|
||||
pub tabs: Vec<TabInfo>,
|
||||
pub active_tab: TabId,
|
||||
/// Only panes in the active tab are transferred. Every pane remains live on the server.
|
||||
/// Only expanded panes in the active tab are transferred. Every pane remains live on the server.
|
||||
pub panes: Vec<PaneSnapshot>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct TabInfo {
|
||||
pub id: TabId,
|
||||
pub title: String,
|
||||
/// All pane IDs, flattened in column/stack order.
|
||||
pub panes: Vec<PaneId>,
|
||||
pub active_pane: PaneId,
|
||||
/// Side-by-side columns; each expands one of its vertically ordered panes.
|
||||
pub stacks: Vec<StackInfo>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct StackInfo {
|
||||
pub panes: Vec<StackPaneInfo>,
|
||||
pub active_pane: PaneId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct StackPaneInfo {
|
||||
pub id: PaneId,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user