fmt and clippy
This commit is contained in:
parent
62d0901bbd
commit
a872362328
15 changed files with 45 additions and 36 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
use zellij_utils::pane_size::PositionAndSize;
|
|
||||||
use ::insta::assert_snapshot;
|
use ::insta::assert_snapshot;
|
||||||
|
use zellij_utils::pane_size::PositionAndSize;
|
||||||
|
|
||||||
use zellij_utils::input::config::Config;
|
|
||||||
use crate::tests::fakes::FakeInputOutput;
|
use crate::tests::fakes::FakeInputOutput;
|
||||||
use crate::tests::start;
|
use crate::tests::start;
|
||||||
use crate::tests::utils::commands::{
|
use crate::tests::utils::commands::{
|
||||||
|
|
@ -12,6 +11,7 @@ use crate::tests::utils::commands::{
|
||||||
};
|
};
|
||||||
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
||||||
use crate::CliArgs;
|
use crate::CliArgs;
|
||||||
|
use zellij_utils::input::config::Config;
|
||||||
|
|
||||||
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
|
fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput {
|
||||||
FakeInputOutput::new(fake_win_size.clone())
|
FakeInputOutput::new(fake_win_size.clone())
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use insta::assert_snapshot;
|
use insta::assert_snapshot;
|
||||||
|
|
||||||
use zellij_utils::pane_size::PositionAndSize;
|
|
||||||
use crate::tests::fakes::FakeInputOutput;
|
use crate::tests::fakes::FakeInputOutput;
|
||||||
use crate::tests::start;
|
use crate::tests::start;
|
||||||
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
||||||
use crate::CliArgs;
|
use crate::CliArgs;
|
||||||
|
use zellij_utils::pane_size::PositionAndSize;
|
||||||
|
|
||||||
use crate::tests::utils::commands::{
|
use crate::tests::utils::commands::{
|
||||||
MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE,
|
MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_DOWN_IN_RESIZE_MODE,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use ::insta::assert_snapshot;
|
use ::insta::assert_snapshot;
|
||||||
|
|
||||||
use zellij_utils::pane_size::PositionAndSize;
|
|
||||||
use crate::tests::fakes::FakeInputOutput;
|
use crate::tests::fakes::FakeInputOutput;
|
||||||
use crate::tests::start;
|
use crate::tests::start;
|
||||||
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
|
||||||
use crate::CliArgs;
|
use crate::CliArgs;
|
||||||
|
use zellij_utils::pane_size::PositionAndSize;
|
||||||
|
|
||||||
use crate::tests::utils::commands::{
|
use crate::tests::utils::commands::{
|
||||||
MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_MODE, RESIZE_RIGHT_IN_RESIZE_MODE,
|
MOVE_FOCUS_IN_PANE_MODE, PANE_MODE, QUIT, RESIZE_MODE, RESIZE_RIGHT_IN_RESIZE_MODE,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
//! Main input logic.
|
//! Main input logic.
|
||||||
|
|
||||||
use crate::{
|
use crate::{os_input_output::ClientOsApi, ClientInstruction, CommandIsExecuting};
|
||||||
ClientInstruction,
|
|
||||||
CommandIsExecuting,
|
|
||||||
os_input_output::ClientOsApi,
|
|
||||||
};
|
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
channels::{SenderWithContext, OPENCALLS},
|
channels::{SenderWithContext, OPENCALLS},
|
||||||
errors::ContextType,
|
errors::ContextType,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ use std::process::Command;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use crate::{command_is_executing::CommandIsExecuting, input_handler::input_loop, os_input_output::ClientOsApi};
|
use crate::{
|
||||||
|
command_is_executing::CommandIsExecuting, input_handler::input_loop,
|
||||||
|
os_input_output::ClientOsApi,
|
||||||
|
};
|
||||||
use zellij_utils::cli::CliArgs;
|
use zellij_utils::cli::CliArgs;
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
channels::{SenderType, SenderWithContext, SyncChannelWithContext},
|
channels::{SenderType, SenderWithContext, SyncChannelWithContext},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
pub mod os_input_output;
|
||||||
pub mod panes;
|
pub mod panes;
|
||||||
pub mod tab;
|
pub mod tab;
|
||||||
pub mod os_input_output;
|
|
||||||
|
|
||||||
mod pty;
|
mod pty;
|
||||||
mod route;
|
mod route;
|
||||||
|
|
@ -16,12 +16,12 @@ use wasmer::Store;
|
||||||
use zellij_tile::data::PluginCapabilities;
|
use zellij_tile::data::PluginCapabilities;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
os_input_output::ServerOsApi,
|
||||||
pty::{pty_thread_main, Pty, PtyInstruction},
|
pty::{pty_thread_main, Pty, PtyInstruction},
|
||||||
screen::{screen_thread_main, ScreenInstruction},
|
screen::{screen_thread_main, ScreenInstruction},
|
||||||
thread_bus::{Bus, ThreadSenders},
|
thread_bus::{Bus, ThreadSenders},
|
||||||
ui::layout::Layout,
|
ui::layout::Layout,
|
||||||
wasm_vm::{wasm_thread_main, PluginInstruction},
|
wasm_vm::{wasm_thread_main, PluginInstruction},
|
||||||
os_input_output::ServerOsApi,
|
|
||||||
};
|
};
|
||||||
use route::route_thread_main;
|
use route::route_thread_main;
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
|
|
|
||||||
|
|
@ -1434,13 +1434,19 @@ impl Debug for Row {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Row {
|
impl Default for Row {
|
||||||
pub fn new() -> Self {
|
fn default() -> Self {
|
||||||
Row {
|
Row {
|
||||||
columns: vec![],
|
columns: vec![],
|
||||||
is_canonical: false,
|
is_canonical: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Row {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
pub fn from_columns(columns: Vec<TerminalCharacter>) -> Self {
|
pub fn from_columns(columns: Vec<TerminalCharacter>) -> Self {
|
||||||
Row {
|
Row {
|
||||||
columns,
|
columns,
|
||||||
|
|
@ -1526,6 +1532,9 @@ impl Row {
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.columns.len()
|
self.columns.len()
|
||||||
}
|
}
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.columns.is_empty()
|
||||||
|
}
|
||||||
pub fn delete_character(&mut self, x: usize) {
|
pub fn delete_character(&mut self, x: usize) {
|
||||||
if x < self.columns.len() {
|
if x < self.columns.len() {
|
||||||
self.columns.remove(x);
|
self.columns.remove(x);
|
||||||
|
|
|
||||||
|
|
@ -110,9 +110,9 @@ pub struct CharacterStyles {
|
||||||
pub italic: Option<AnsiCode>,
|
pub italic: Option<AnsiCode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CharacterStyles {
|
impl Default for CharacterStyles {
|
||||||
pub fn new() -> Self {
|
fn default() -> Self {
|
||||||
CharacterStyles {
|
Self {
|
||||||
foreground: None,
|
foreground: None,
|
||||||
background: None,
|
background: None,
|
||||||
strike: None,
|
strike: None,
|
||||||
|
|
@ -126,6 +126,12 @@ impl CharacterStyles {
|
||||||
italic: None,
|
italic: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CharacterStyles {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
pub fn foreground(mut self, foreground_code: Option<AnsiCode>) -> Self {
|
pub fn foreground(mut self, foreground_code: Option<AnsiCode>) -> Self {
|
||||||
self.foreground = foreground_code;
|
self.foreground = foreground_code;
|
||||||
self
|
self
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ use std::pin::*;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
os_input_output::ServerOsApi,
|
||||||
panes::PaneId,
|
panes::PaneId,
|
||||||
screen::ScreenInstruction,
|
screen::ScreenInstruction,
|
||||||
thread_bus::{Bus, ThreadSenders},
|
thread_bus::{Bus, ThreadSenders},
|
||||||
ui::layout::Layout,
|
ui::layout::Layout,
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction,
|
ServerInstruction,
|
||||||
os_input_output::ServerOsApi,
|
|
||||||
};
|
};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
errors::{get_current_ctx, ContextType, PtyContext},
|
errors::{get_current_ctx, ContextType, PtyContext},
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,8 @@ use std::sync::{Arc, RwLock};
|
||||||
use zellij_tile::data::Event;
|
use zellij_tile::data::Event;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
pty::PtyInstruction, screen::ScreenInstruction, wasm_vm::PluginInstruction, ServerInstruction,
|
os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction,
|
||||||
SessionMetaData,
|
wasm_vm::PluginInstruction, ServerInstruction, SessionMetaData,
|
||||||
os_input_output::ServerOsApi,
|
|
||||||
};
|
};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
channels::SenderWithContext,
|
channels::SenderWithContext,
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
//! as well as how they should be resized
|
//! as well as how they should be resized
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
os_input_output::ServerOsApi,
|
||||||
panes::{PaneId, PluginPane, TerminalPane},
|
panes::{PaneId, PluginPane, TerminalPane},
|
||||||
pty::{PtyInstruction, VteBytes},
|
pty::{PtyInstruction, VteBytes},
|
||||||
thread_bus::ThreadSenders,
|
thread_bus::ThreadSenders,
|
||||||
ui::{boundaries::Boundaries, layout::Layout, pane_resizer::PaneResizer},
|
ui::{boundaries::Boundaries, layout::Layout, pane_resizer::PaneResizer},
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction,
|
ServerInstruction,
|
||||||
os_input_output::ServerOsApi,
|
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::os::unix::io::RawFd;
|
use std::os::unix::io::RawFd;
|
||||||
|
|
@ -19,10 +19,7 @@ use std::{
|
||||||
collections::{BTreeMap, HashSet},
|
collections::{BTreeMap, HashSet},
|
||||||
};
|
};
|
||||||
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
||||||
use zellij_utils::{
|
use zellij_utils::{input::parse_keys, pane_size::PositionAndSize, shared::adjust_to_size};
|
||||||
input::parse_keys, pane_size::PositionAndSize,
|
|
||||||
shared::adjust_to_size,
|
|
||||||
};
|
|
||||||
|
|
||||||
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
//! Definitions and helpers for sending and receiving messages between threads.
|
//! Definitions and helpers for sending and receiving messages between threads.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
pty::PtyInstruction, screen::ScreenInstruction, wasm_vm::PluginInstruction, ServerInstruction, os_input_output::ServerOsApi
|
os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction,
|
||||||
|
wasm_vm::PluginInstruction, ServerInstruction,
|
||||||
};
|
};
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use zellij_utils::{
|
use zellij_utils::{channels::SenderWithContext, errors::ErrorContext};
|
||||||
channels::SenderWithContext, errors::ErrorContext,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A container for senders to the different threads in zellij on the server side
|
/// A container for senders to the different threads in zellij on the server side
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::{panes::PaneId, os_input_output::ServerOsApi, tab::Pane};
|
use crate::{os_input_output::ServerOsApi, panes::PaneId, tab::Pane};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
collections::{BTreeMap, HashSet},
|
collections::{BTreeMap, HashSet},
|
||||||
};
|
};
|
||||||
use zellij_utils::{pane_size::PositionAndSize};
|
use zellij_utils::pane_size::PositionAndSize;
|
||||||
|
|
||||||
pub(crate) struct PaneResizer<'a> {
|
pub(crate) struct PaneResizer<'a> {
|
||||||
panes: &'a mut BTreeMap<PaneId, Box<dyn Pane>>,
|
panes: &'a mut BTreeMap<PaneId, Box<dyn Pane>>,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! Error context system based on a thread-local representation of the call stack, itself based on
|
//! Error context system based on a thread-local representation of the call stack, itself based on
|
||||||
//! the instructions that are sent between threads.
|
//! the instructions that are sent between threads.
|
||||||
|
|
||||||
use crate::channels::{ASYNCOPENCALLS, OPENCALLS, SenderWithContext};
|
use crate::channels::{SenderWithContext, ASYNCOPENCALLS, OPENCALLS};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt::{Display, Error, Formatter};
|
use std::fmt::{Display, Error, Formatter};
|
||||||
use std::panic::PanicInfo;
|
use std::panic::PanicInfo;
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ use std::{iter, str::from_utf8};
|
||||||
use strip_ansi_escapes::strip;
|
use strip_ansi_escapes::strip;
|
||||||
|
|
||||||
use colors_transform::{Color, Rgb};
|
use colors_transform::{Color, Rgb};
|
||||||
use zellij_tile::data::{Palette, PaletteColor, PaletteSource, Theme};
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::os::unix::{fs::PermissionsExt};
|
use std::path::Path;
|
||||||
use std::path::{Path};
|
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
|
use zellij_tile::data::{Palette, PaletteColor, PaletteSource, Theme};
|
||||||
|
|
||||||
const UNIX_PERMISSIONS: u32 = 0o700;
|
const UNIX_PERMISSIONS: u32 = 0o700;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue