Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
refs: #1090
  • Loading branch information
wez committed Jan 17, 2022
1 parent 9b7489e commit db01691
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
7 changes: 4 additions & 3 deletions mux/src/tmux.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -19,6 +18,7 @@ enum State {
WaitingForResponse,
}

#[allow(dead_code)]
#[derive(Debug)]
pub(crate) struct TmuxRemotePane {
// members for local
Expand All @@ -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,
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions mux/src/tmux_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()?;
Expand Down Expand Up @@ -237,7 +237,7 @@ impl TmuxCommand for ListAllPanes {
session_id,
window_id,
pane_id,
pane_index,
_pane_index,
cursor_x,
cursor_y,
pane_width,
Expand Down
37 changes: 31 additions & 6 deletions mux/src/tmux_pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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();
Expand All @@ -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(())
}

Expand Down
4 changes: 2 additions & 2 deletions termwiz/src/escape/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit db01691

Please sign in to comment.