1 parent
9b7489ed97
commit
db01691359
4 files changed
+40
-14
No files matched your search
+4
-3
@@ -1,8 +1,7 @@
|
||||
use crate::domain::{alloc_domain_id, Domain, DomainId, DomainState};
|
||||
use crate::pane::{Pane, PaneId};
|
||||
use crate::tab::{SplitDirection, Tab, TabId};
|
||||
use crate::tab::TabId;
|
||||
use crate::tmux_commands::{ListAllPanes, TmuxCommand};
|
||||
use crate::window::WindowId;
|
||||
use crate::{Mux, MuxWindowBuilder};
|
||||
use async_trait::async_trait;
|
||||
use portable_pty::{CommandBuilder, PtySize};
|
||||
@@ -19,6 +18,7 @@ enum State {
|
||||
WaitingForResponse,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct TmuxRemotePane {
|
||||
// members for local
|
||||
@@ -41,6 +41,7 @@ pub(crate) type RefTmuxRemotePane = Arc<Mutex<TmuxRemotePane>>;
|
||||
|
||||
/// As a remote TmuxTab, keeping the TmuxPanes ID
|
||||
/// within the remote tab.
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct TmuxTab {
|
||||
pub tab_id: TabId, // local tab ID
|
||||
pub tmux_window_id: TmuxWindowId,
|
||||
@@ -164,7 +165,7 @@ impl TmuxDomainState {
|
||||
pub fn create_gui_window(&self) {
|
||||
if self.gui_window.borrow().is_none() {
|
||||
let mux = Mux::get().expect("should be call at main thread");
|
||||
let window_builder = mux.new_empty_window();
|
||||
let window_builder = mux.new_empty_window(None /* TODO: pass session here */);
|
||||
log::info!("Tmux create window id {}", window_builder.window_id);
|
||||
{
|
||||
let mut window_id = self.gui_window.borrow_mut();
|
||||
|
||||
@@ -25,7 +25,7 @@ pub(crate) struct PaneItem {
|
||||
session_id: TmuxSessionId,
|
||||
window_id: TmuxWindowId,
|
||||
pane_id: TmuxPaneId,
|
||||
pane_index: u64,
|
||||
_pane_index: u64,
|
||||
cursor_x: u64,
|
||||
cursor_y: u64,
|
||||
pane_width: u64,
|
||||
@@ -198,7 +198,7 @@ impl TmuxCommand for ListAllPanes {
|
||||
let session_id = fields.next().ok_or_else(|| anyhow!("missing session_id"))?;
|
||||
let window_id = fields.next().ok_or_else(|| anyhow!("missing window_id"))?;
|
||||
let pane_id = fields.next().ok_or_else(|| anyhow!("missing pane_id"))?;
|
||||
let pane_index = fields
|
||||
let _pane_index = fields
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("missing pane_index"))?
|
||||
.parse()?;
|
||||
@@ -237,7 +237,7 @@ impl TmuxCommand for ListAllPanes {
|
||||
session_id,
|
||||
window_id,
|
||||
pane_id,
|
||||
pane_index,
|
||||
_pane_index,
|
||||
cursor_x,
|
||||
cursor_y,
|
||||
pane_width,
|
||||
|
||||
+31
-6
@@ -2,7 +2,7 @@ use crate::{
|
||||
tmux::{RefTmuxRemotePane, TmuxCmdQueue, TmuxDomainState},
|
||||
tmux_commands::SendKeys,
|
||||
};
|
||||
use portable_pty::{Child, ExitStatus, MasterPty};
|
||||
use portable_pty::{Child, ChildKiller, ExitStatus, MasterPty};
|
||||
use std::{
|
||||
io::{Read, Write},
|
||||
sync::{Arc, Condvar, Mutex},
|
||||
@@ -95,10 +95,6 @@ impl Child for TmuxPty {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn kill(&mut self) -> std::io::Result<()> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn wait(&mut self) -> std::io::Result<portable_pty::ExitStatus> {
|
||||
let (lock, var) = &*self.active_lock;
|
||||
let mut released = lock.lock().unwrap();
|
||||
@@ -118,9 +114,38 @@ impl Child for TmuxPty {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct TmuxChildKiller {}
|
||||
|
||||
impl ChildKiller for TmuxChildKiller {
|
||||
fn kill(&mut self) -> std::io::Result<()> {
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"TmuxChildKiller: kill not implemented!",
|
||||
))
|
||||
}
|
||||
|
||||
fn clone_killer(&self) -> Box<dyn ChildKiller + Send + Sync> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl ChildKiller for TmuxPty {
|
||||
fn kill(&mut self) -> std::io::Result<()> {
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"TmuxPty: kill not implemented!",
|
||||
))
|
||||
}
|
||||
|
||||
fn clone_killer(&self) -> Box<dyn ChildKiller + Send + Sync> {
|
||||
Box::new(TmuxChildKiller {})
|
||||
}
|
||||
}
|
||||
|
||||
impl MasterPty for TmuxPty {
|
||||
fn resize(&self, size: portable_pty::PtySize) -> Result<(), anyhow::Error> {
|
||||
// TODO: perform pane resize
|
||||
log::warn!("TODO: perform pane resize");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ use crate::escape::{
|
||||
use log::error;
|
||||
use num_traits::FromPrimitive;
|
||||
use regex::bytes::Regex;
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::borrow::BorrowMut;
|
||||
use std::cell::RefCell;
|
||||
use tmux_cc::Event;
|
||||
use vtparse::{CsiParam, VTActor, VTParser};
|
||||
|
||||
|
||||
Reference in new issue
Block a user