Skip to content

Commit

Permalink
move tmux-cc crate to be module inside termwiz
Browse files Browse the repository at this point in the history
refs: #1090
  • Loading branch information
wez committed Jan 17, 2022
1 parent db01691 commit 8f31aed
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 40 deletions.
17 changes: 3 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion mux/Cargo.toml
Expand Up @@ -37,7 +37,6 @@ terminfo = "0.7"
termwiz = { path = "../termwiz" }
textwrap = "0.14"
thiserror = "1.0"
tmux-cc = { path = "../tmux-cc" }
unicode-segmentation = "1.8"
url = "2"
wezterm-ssh = { path = "../wezterm-ssh" }
Expand Down
2 changes: 1 addition & 1 deletion mux/src/tmux.rs
Expand Up @@ -9,7 +9,7 @@ use std::cell::RefCell;
use std::collections::{HashMap, HashSet, VecDeque};
use std::rc::Rc;
use std::sync::{Arc, Condvar, Mutex};
use tmux_cc::*;
use termwiz::tmux_cc::*;

#[derive(PartialEq, Eq, Debug, Copy, Clone)]
enum State {
Expand Down
2 changes: 1 addition & 1 deletion mux/src/tmux_commands.rs
Expand Up @@ -13,7 +13,7 @@ use std::fmt::Debug;
use std::fmt::Write;
use std::rc::Rc;
use std::sync::{Arc, Condvar, Mutex};
use tmux_cc::*;
use termwiz::tmux_cc::*;

pub(crate) trait TmuxCommand: Send + Debug {
fn get_command(&self) -> String;
Expand Down
4 changes: 3 additions & 1 deletion termwiz/Cargo.toml
Expand Up @@ -26,13 +26,14 @@ log = "0.4"
memmem = "0.1"
num-traits = "0.2"
ordered-float = "2.10"
pest = "2.1"
pest_derive = "2.1"
regex = "1"
semver = "0.11"
serde = {version="1.0", features = ["rc", "derive"], optional=true}
sha2 = "0.9"
terminfo = "0.7"
thiserror = "1.0"
tmux-cc = {version = "0.1", path = "../tmux-cc"}
unicode-segmentation = "1.8"
ucd-trie = "0.1"
vtparse = { version="0.6", path="../vtparse" }
Expand All @@ -46,6 +47,7 @@ docs = ["widgets", "use_serde"]
[dev-dependencies]
varbincode = "0.1"
pretty_assertions = "0.6"
pretty_env_logger = "0.4"

[dependencies.num-derive]
features = ["full-syntax"]
Expand Down
2 changes: 1 addition & 1 deletion termwiz/src/escape/mod.rs
Expand Up @@ -6,9 +6,9 @@
//! semantic meaning to them. It can also encode the semantic values as
//! escape sequences. It provides encoding and decoding functionality
//! only; it does not provide terminal emulation facilities itself.
use crate::tmux_cc::Event;
use num_derive::*;
use std::fmt::{Display, Error as FmtError, Formatter, Write as FmtWrite};
use tmux_cc::Event;

pub mod apc;
pub mod csi;
Expand Down
7 changes: 4 additions & 3 deletions termwiz/src/escape/parser/mod.rs
Expand Up @@ -4,12 +4,12 @@ use crate::escape::{
Action, DeviceControlMode, EnterDeviceControlMode, Esc, OperatingSystemCommand,
ShortDeviceControl, Sixel, SixelData, CSI,
};
use crate::tmux_cc::Event;
use log::error;
use num_traits::FromPrimitive;
use regex::bytes::Regex;
use std::borrow::BorrowMut;
use std::cell::RefCell;
use tmux_cc::Event;
use vtparse::{CsiParam, VTActor, VTParser};

struct SixelBuilder {
Expand Down Expand Up @@ -55,7 +55,7 @@ struct ParseState {
sixel: Option<SixelBuilder>,
dcs: Option<ShortDeviceControl>,
get_tcap: Option<GetTcapBuilder>,
tmux_state: Option<RefCell<tmux_cc::Parser>>,
tmux_state: Option<RefCell<crate::tmux_cc::Parser>>,
}

/// The `Parser` struct holds the state machine that is used to decode
Expand Down Expand Up @@ -251,7 +251,8 @@ impl<'a, F: FnMut(Action)> VTActor for Performer<'a, F> {
} else {
if byte == b'p' && params == [1000] {
// into tmux_cc mode
self.state.borrow_mut().tmux_state = Some(RefCell::new(tmux_cc::Parser::new()));
self.state.borrow_mut().tmux_state =
Some(RefCell::new(crate::tmux_cc::Parser::new()));
}
(self.callback)(Action::DeviceControl(DeviceControlMode::Enter(Box::new(
EnterDeviceControlMode {
Expand Down
1 change: 1 addition & 0 deletions termwiz/src/lib.rs
Expand Up @@ -63,6 +63,7 @@ mod readbuf;
pub mod render;
pub mod surface;
pub mod terminal;
pub mod tmux_cc;
#[cfg(feature = "widgets")]
pub mod widgets;

Expand Down
2 changes: 1 addition & 1 deletion tmux-cc/src/lib.rs → termwiz/src/tmux_cc/mod.rs
Expand Up @@ -10,7 +10,7 @@ pub type TmuxSessionId = u64;
mod parser {
use pest_derive::Parser;
#[derive(Parser)]
#[grammar = "tmux.pest"]
#[grammar = "tmux_cc/tmux.pest"]
pub struct TmuxParser;
}

Expand Down
File renamed without changes.
17 changes: 0 additions & 17 deletions tmux-cc/Cargo.toml

This file was deleted.

0 comments on commit 8f31aed

Please sign in to comment.