1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 04:56:12 +03:00

move tmux-cc crate to be module inside termwiz

refs: #1090
This commit is contained in:
Wez Furlong 2022-01-17 13:43:35 -07:00
parent db01691359
commit 8f31aed3f1
11 changed files with 15 additions and 40 deletions

17
Cargo.lock generated
View File

@ -2321,7 +2321,6 @@ dependencies = [
"termwiz",
"textwrap 0.14.2",
"thiserror",
"tmux-cc",
"unicode-segmentation",
"url",
"wezterm-ssh",
@ -4103,7 +4102,10 @@ dependencies = [
"num-derive",
"num-traits",
"ordered-float",
"pest",
"pest_derive",
"pretty_assertions",
"pretty_env_logger",
"regex",
"semver 0.11.0",
"serde",
@ -4112,7 +4114,6 @@ dependencies = [
"terminfo",
"termios 0.3.3",
"thiserror",
"tmux-cc",
"ucd-trie",
"unicode-segmentation",
"varbincode",
@ -4219,18 +4220,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tmux-cc"
version = "0.1.0"
dependencies = [
"anyhow",
"log",
"pest",
"pest_derive",
"pretty_assertions",
"pretty_env_logger",
]
[[package]]
name = "toml"
version = "0.5.8"

View File

@ -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" }

View File

@ -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 {

View File

@ -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;

View File

@ -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" }
@ -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"]

View File

@ -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;

View File

@ -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 {
@ -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
@ -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 {

View File

@ -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;

View File

@ -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;
}

View File

@ -1,17 +0,0 @@
[package]
name = "tmux-cc"
version = "0.1.0"
authors = ["Wez Furlong <wez@wezfurlong.org>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0"
log = "0.4"
pest = "2.1"
pest_derive = "2.1"
[dev-dependencies]
pretty_env_logger = "0.4"
pretty_assertions = "0.6"