[WIP] sync tmux panes
This commit is contained in:
1 parent
b0f0050daf
commit
e45a268ed1
2 files changed
+21
-9
No files matched your search
+10
-5
@@ -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<Parser>,
|
||||
state: RefCell<State>,
|
||||
cmd_queue: RefCell<VecDeque<Box<dyn TmuxCommand>>>,
|
||||
gui_window_id: RefCell<Option<usize>>,
|
||||
gui_tabs: RefCell<Vec<TmuxTab>>,
|
||||
remote_panes: RefCell<HashMap<TmuxPaneId, RefTmuxRemotePane>>,
|
||||
pub cmd_queue: RefCell<VecDeque<Box<dyn TmuxCommand>>>,
|
||||
pub gui_window_id: RefCell<Option<usize>>,
|
||||
pub gui_tabs: RefCell<Vec<TmuxTab>>,
|
||||
pub remote_panes: RefCell<HashMap<TmuxPaneId, RefTmuxRemotePane>>,
|
||||
pub tmux_session: RefCell<Option<TmuxSessionId>>,
|
||||
}
|
||||
|
||||
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 }
|
||||
}
|
||||
|
||||
@@ -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<PaneItem>),
|
||||
}
|
||||
|
||||
pub(crate) struct ListAllPanes;
|
||||
impl TmuxCommand for ListAllPanes {
|
||||
fn get_command(&self) -> String {
|
||||
|
||||
Reference in new issue
Block a user