diff --git a/mux/src/tmux.rs b/mux/src/tmux.rs index 58807e092..d76763651 100644 --- a/mux/src/tmux.rs +++ b/mux/src/tmux.rs @@ -45,14 +45,15 @@ pub(crate) struct TmuxTab { } pub(crate) struct TmuxDomainState { - pane_id: PaneId, + pub pane_id: PaneId, pub domain_id: DomainId, // parser: RefCell, state: RefCell, - cmd_queue: RefCell>>, - gui_window_id: RefCell>, - gui_tabs: RefCell>, - remote_panes: RefCell>, + pub cmd_queue: RefCell>>, + pub gui_window_id: RefCell>, + pub gui_tabs: RefCell>, + pub remote_panes: RefCell>, + pub tmux_session: RefCell>, } pub struct TmuxDomain { @@ -106,6 +107,9 @@ impl TmuxDomainState { } } } + Event::SessionChanged { session, name: _ } => { + *self.tmux_session.borrow_mut() = Some(*session); + } _ => {} } } @@ -157,6 +161,7 @@ impl TmuxDomain { gui_window_id: RefCell::new(None), gui_tabs: RefCell::new(Vec::default()), remote_panes: RefCell::new(HashMap::default()), + tmux_session: RefCell::new(None), }); Self { inner } } diff --git a/mux/src/tmux_commands.rs b/mux/src/tmux_commands.rs index 764ac970b..e8b130b94 100644 --- a/mux/src/tmux_commands.rs +++ b/mux/src/tmux_commands.rs @@ -25,14 +25,21 @@ pub(crate) struct PaneItem { impl TmuxDomainState { fn sync_pane_state(&self, panes: &[PaneItem]) -> anyhow::Result<()> { + // TODO: + // 1) iter over current session panes + // 2) create pane if not exist + // 3) fetch scroll buffer if new created + // 4) update pane state if exist + let current_session = self.tmux_session.borrow().unwrap_or(0); + for pane in panes.iter() { + if pane.session_id != current_session { + continue; + } + } Ok(()) } } -pub(crate) enum TmuxCommandResult { - PaneList(Vec), -} - pub(crate) struct ListAllPanes; impl TmuxCommand for ListAllPanes { fn get_command(&self) -> String {