From db01691359b2901bca5a346feb35f4d2e8c7cc25 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 17 Jan 2022 13:29:40 -0700 Subject: [PATCH] fix build refs: #1090 --- mux/src/tmux.rs | 7 +++--- mux/src/tmux_commands.rs | 6 +++--- mux/src/tmux_pty.rs | 37 ++++++++++++++++++++++++++------ termwiz/src/escape/parser/mod.rs | 4 ++-- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/mux/src/tmux.rs b/mux/src/tmux.rs index 8839926f6b5..c1364f4d7c7 100644 --- a/mux/src/tmux.rs +++ b/mux/src/tmux.rs @@ -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>; /// 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(); diff --git a/mux/src/tmux_commands.rs b/mux/src/tmux_commands.rs index 3c9260e5f59..85b5fd5f1f4 100644 --- a/mux/src/tmux_commands.rs +++ b/mux/src/tmux_commands.rs @@ -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, diff --git a/mux/src/tmux_pty.rs b/mux/src/tmux_pty.rs index 7102a9a1090..a17185898ca 100644 --- a/mux/src/tmux_pty.rs +++ b/mux/src/tmux_pty.rs @@ -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 { 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 { + 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 { + 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(()) } diff --git a/termwiz/src/escape/parser/mod.rs b/termwiz/src/escape/parser/mod.rs index 50b26fe375f..94445af0538 100644 --- a/termwiz/src/escape/parser/mod.rs +++ b/termwiz/src/escape/parser/mod.rs @@ -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};