diff options
Diffstat (limited to 'zellij-server/src')
-rw-r--r-- | zellij-server/src/lib.rs | 7 | ||||
-rw-r--r-- | zellij-server/src/os_input_output.rs | 23 | ||||
-rw-r--r-- | zellij-server/src/panes/grid.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_character.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/unit/grid_tests.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/pty.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/route.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/screen.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/tab.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/ui/boundaries.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/ui/layout.rs | 5 | ||||
-rw-r--r-- | zellij-server/src/wasm_vm.rs | 2 |
13 files changed, 41 insertions, 16 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 8d82313db..df0eea65f 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -9,6 +9,8 @@ mod thread_bus; mod ui; mod wasm_vm; +use zellij_utils::zellij_tile; + use std::sync::{Arc, RwLock}; use std::thread; use std::{path::PathBuf, sync::mpsc}; @@ -131,8 +133,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ - use interprocess::local_socket::LocalSocketListener; - use zellij_utils::shared::set_permissions; + use zellij_utils::{ + interprocess::local_socket::LocalSocketListener, shared::set_permissions, + }; let os_input = os_input.clone(); let sessions = sessions.clone(); diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index bd5e9a486..be51878ce 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -1,3 +1,11 @@ +use std::env; +use std::os::unix::io::RawFd; +use std::path::PathBuf; +use std::process::{Child, Command}; +use std::sync::{Arc, Mutex}; + +use zellij_utils::{interprocess, libc, nix, signal_hook, zellij_tile}; + use interprocess::local_socket::LocalSocketStream; use nix::fcntl::{fcntl, FcntlArg, OFlag}; use nix::pty::{forkpty, Winsize}; @@ -6,17 +14,12 @@ use nix::sys::termios; use nix::sys::wait::waitpid; use nix::unistd::{self, ForkResult}; use signal_hook::consts::*; -use std::env; -use std::os::unix::io::RawFd; -use std::path::PathBuf; -use std::process::{Child, Command}; -use std::sync::{Arc, Mutex}; use zellij_tile::data::Palette; -use zellij_utils::errors::ErrorContext; -use zellij_utils::ipc::{ - ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, +use zellij_utils::{ + errors::ErrorContext, + ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, + shared::default_palette, }; -use zellij_utils::shared::default_palette; pub use nix::unistd::Pid; pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { @@ -37,7 +40,7 @@ pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { /// process exits. fn handle_command_exit(mut child: Child) { // register the SIGINT signal (TODO handle more signals) - let mut signals = ::signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); + let mut signals = signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); 'handle_exit: loop { // test whether the child process has exited match child.try_wait() { diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index d9cef5def..ac347db0e 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -5,11 +5,12 @@ use std::{ str, }; -use vte::{Params, Perform}; +use zellij_utils::{vte, zellij_tile}; const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? const SCROLL_BACK: usize = 10_000; +use vte::{Params, Perform}; use zellij_tile::data::{Palette, PaletteColor}; use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number}; diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index c55569f05..e6489eb42 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -3,8 +3,8 @@ use unicode_width::UnicodeWidthChar; use std::convert::TryFrom; use std::fmt::{self, Debug, Display, Formatter}; use std::ops::{Index, IndexMut}; -use vte::ParamsIter; use zellij_utils::logging::debug_log_to_file; +use zellij_utils::vte::ParamsIter; pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter { character: ' ', diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index eaeb00264..7e45c77bb 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -1,3 +1,5 @@ +use zellij_utils::{vte, zellij_tile}; + use std::fmt::Debug; use std::os::unix::io::RawFd; use std::time::Instant; diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index 7612a05d1..1a1d7f5cc 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -1,6 +1,6 @@ use super::super::Grid; use ::insta::assert_snapshot; -use zellij_tile::data::Palette; +use zellij_utils::{vte, zellij_tile::data::Palette}; fn read_fixture(fixture_name: &str) -> Vec<u8> { let mut path_to_file = std::path::PathBuf::new(); diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 9bf1bddfd..ecaef460a 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -1,3 +1,5 @@ +use zellij_utils::{async_std, nix}; + use async_std::stream::*; use async_std::task; use async_std::task::*; diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index daa0c0ead..0187d9536 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use zellij_tile::data::Event; +use zellij_utils::zellij_tile::data::Event; use crate::{ os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction, diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 0500d296d..830c42511 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -4,6 +4,8 @@ use std::collections::BTreeMap; use std::os::unix::io::RawFd; use std::str; +use zellij_utils::zellij_tile; + use crate::{ panes::PaneId, pty::{PtyInstruction, VteBytes}, diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs index 78586d7a7..e6953bfa2 100644 --- a/zellij-server/src/tab.rs +++ b/zellij-server/src/tab.rs @@ -1,6 +1,8 @@ //! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size, //! as well as how they should be resized +use zellij_utils::{serde, zellij_tile}; + use crate::{ os_input_output::ServerOsApi, panes::{PaneId, PluginPane, TerminalPane}, @@ -78,6 +80,7 @@ pub(crate) struct Tab { } #[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[serde(crate = "self::serde")] pub(crate) struct TabData { /* subset of fields to publish to plugins */ pub position: usize, diff --git a/zellij-server/src/ui/boundaries.rs b/zellij-server/src/ui/boundaries.rs index 984b13762..42a80ace1 100644 --- a/zellij-server/src/ui/boundaries.rs +++ b/zellij-server/src/ui/boundaries.rs @@ -1,3 +1,5 @@ +use zellij_utils::zellij_tile; + use crate::tab::Pane; use ansi_term::Colour::{Fixed, RGB}; use std::collections::HashMap; diff --git a/zellij-server/src/ui/layout.rs b/zellij-server/src/ui/layout.rs index 3965b478c..a9af665fa 100644 --- a/zellij-server/src/ui/layout.rs +++ b/zellij-server/src/ui/layout.rs @@ -1,3 +1,5 @@ +use zellij_utils::{serde, serde_yaml}; + use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::{fs::File, io::prelude::*}; @@ -167,18 +169,21 @@ fn split_space( } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) enum Direction { Horizontal, Vertical, } #[derive(Debug, Serialize, Deserialize, Clone, Copy)] +#[serde(crate = "self::serde")] pub(crate) enum SplitSize { Percent(u8), // 1 to 100 Fixed(u16), // An absolute number of columns or rows } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) struct Layout { pub direction: Direction, #[serde(default, skip_serializing_if = "Vec::is_empty")] diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index 65f5358ad..53dceaa75 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -7,6 +7,8 @@ use std::sync::{mpsc::Sender, Arc, Mutex}; use std::thread; use std::time::{Duration, Instant}; +use zellij_utils::{serde, zellij_tile}; + use serde::{de::DeserializeOwned, Serialize}; use wasmer::{ imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value, |