aboutsummaryrefslogtreecommitdiff
path: root/src/workspace/tab.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-17 01:41:16 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-17 01:41:16 +0300
commit86adf88351e17c6a11cac253714b169eac0db233 (patch)
tree883d32b0126e0b69449e0e9c0a7017d279c23935 /src/workspace/tab.rs
parentd2aa8865911ded97a67054fb2392a1c12fae018c (diff)
feat: add terminal identity and agent cli facade
Diffstat (limited to 'src/workspace/tab.rs')
-rw-r--r--src/workspace/tab.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/workspace/tab.rs b/src/workspace/tab.rs
index f8b31eb5..6f3177be 100644
--- a/src/workspace/tab.rs
+++ b/src/workspace/tab.rs
@@ -9,6 +9,7 @@ use tokio::sync::{mpsc, Notify};
use crate::events::AppEvent;
use crate::layout::{PaneId, TileLayout};
use crate::pane::{PaneRuntime, PaneState};
+use crate::terminal::TerminalId;
pub struct Tab {
pub custom_name: Option<String>,
@@ -20,6 +21,8 @@ pub struct Tab {
pub panes: HashMap<PaneId, PaneState>,
/// Best-effort cwd cache per pane. Live runtime cwd wins when available.
pub pane_cwds: HashMap<PaneId, PathBuf>,
+ /// One-to-one terminal identity for each pane-backed PTY during the transition.
+ pub terminal_ids: HashMap<PaneId, TerminalId>,
/// Pane runtimes — only present in production (empty in tests).
pub runtimes: HashMap<PaneId, PaneRuntime>,
pub zoomed: bool,
@@ -66,6 +69,8 @@ impl Tab {
panes.insert(root_id, PaneState::new());
let mut pane_cwds = HashMap::new();
pane_cwds.insert(root_id, initial_cwd);
+ let mut terminal_ids = HashMap::new();
+ terminal_ids.insert(root_id, TerminalId::alloc());
let mut runtimes = HashMap::new();
runtimes.insert(root_id, runtime);
@@ -76,6 +81,7 @@ impl Tab {
layout,
panes,
pane_cwds,
+ terminal_ids,
runtimes,
zoomed: false,
events,
@@ -182,6 +188,7 @@ impl Tab {
};
self.panes.insert(new_id, PaneState::new());
self.pane_cwds.insert(new_id, actual_cwd);
+ self.terminal_ids.insert(new_id, TerminalId::alloc());
self.runtimes.insert(new_id, runtime);
self.zoomed = false;
Ok(new_id)
@@ -218,6 +225,7 @@ impl Tab {
self.panes.remove(&pane_id);
self.pane_cwds.remove(&pane_id);
+ self.terminal_ids.remove(&pane_id);
let runtime = self.runtimes.remove(&pane_id);
self.zoomed = false;
if let Some(next_root) = next_root {
@@ -237,6 +245,10 @@ impl Tab {
self.runtimes.get(&self.layout.focused())
}
+ pub fn terminal_id(&self, pane_id: PaneId) -> Option<&TerminalId> {
+ self.terminal_ids.get(&pane_id)
+ }
+
pub fn cwd_for_pane(&self, pane_id: PaneId) -> Option<PathBuf> {
self.runtimes
.get(&pane_id)