style: some cleanups (#4329)
* style: some cleanups * style(fmt): rustfmt
This commit is contained in:
parent
549c5edb46
commit
b5a893f36a
12 changed files with 12 additions and 44 deletions
|
|
@ -378,6 +378,7 @@ impl State {
|
||||||
|
|
||||||
// Tooltip operations
|
// Tooltip operations
|
||||||
fn toggle_persisted_tooltip(&self, new_mode: InputMode) {
|
fn toggle_persisted_tooltip(&self, new_mode: InputMode) {
|
||||||
|
#[allow(unused_variables)]
|
||||||
let message = self
|
let message = self
|
||||||
.create_tooltip_message(MSG_TOGGLE_PERSISTED_TOOLTIP, new_mode)
|
.create_tooltip_message(MSG_TOGGLE_PERSISTED_TOOLTIP, new_mode)
|
||||||
.with_args(self.create_persist_args());
|
.with_args(self.create_persist_args());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
#[allow(unused_imports)]
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use zellij_tile::prelude::*;
|
use zellij_tile::prelude::*;
|
||||||
|
|
||||||
|
|
@ -7,6 +8,7 @@ use zellij_tile::prelude::*;
|
||||||
// it is not (and should not!) be included in the mainline executable
|
// it is not (and should not!) be included in the mainline executable
|
||||||
// it's included here for convenience so that it will be built by the CI
|
// it's included here for convenience so that it will be built by the CI
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct State {
|
struct State {
|
||||||
received_events: Vec<Event>,
|
received_events: Vec<Event>,
|
||||||
|
|
|
||||||
|
|
@ -700,10 +700,6 @@ pub mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_palette() -> Palette {
|
|
||||||
Palette::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn style_key_with_modifier_only_chars() {
|
fn style_key_with_modifier_only_chars() {
|
||||||
let keyvec = vec![
|
let keyvec = vec![
|
||||||
|
|
|
||||||
|
|
@ -531,10 +531,6 @@ mod tests {
|
||||||
string.to_string()
|
string.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_palette() -> Palette {
|
|
||||||
Palette::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn full_length_shortcut_with_key() {
|
fn full_length_shortcut_with_key() {
|
||||||
let keyvec = vec![KeyWithModifier::new(BareKey::Char('a'))];
|
let keyvec = vec![KeyWithModifier::new(BareKey::Char('a'))];
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::shared::{calculate_list_bounds, render_list_tip};
|
use crate::shared::{calculate_list_bounds, render_list_tip};
|
||||||
use crate::state::{refresh_directory, ROOT};
|
use crate::state::refresh_directory;
|
||||||
use pretty_bytes::converter::convert as pretty_bytes;
|
use pretty_bytes::converter::convert as pretty_bytes;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use zellij_tile::prelude::*;
|
use zellij_tile::prelude::*;
|
||||||
|
|
||||||
|
|
@ -58,17 +58,6 @@ impl FileListView {
|
||||||
self.cursor_hist.remove(&self.path);
|
self.cursor_hist.remove(&self.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_relative_path(&self) -> PathBuf {
|
|
||||||
if let Some(initial_cwd_part) = self.path.iter().next() {
|
|
||||||
self.path
|
|
||||||
.strip_prefix(initial_cwd_part)
|
|
||||||
.unwrap_or(&self.path)
|
|
||||||
.to_path_buf()
|
|
||||||
} else {
|
|
||||||
PathBuf::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn update_files(
|
pub fn update_files(
|
||||||
&mut self,
|
&mut self,
|
||||||
paths: Vec<(PathBuf, Option<FileMetadata>)>,
|
paths: Vec<(PathBuf, Option<FileMetadata>)>,
|
||||||
|
|
@ -193,19 +182,6 @@ impl FsEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pathbuf_without_root_prefix(&self) -> PathBuf {
|
|
||||||
match self {
|
|
||||||
FsEntry::Dir(p) => p
|
|
||||||
.strip_prefix(ROOT)
|
|
||||||
.map(|p| p.to_path_buf())
|
|
||||||
.unwrap_or_else(|_| p.clone()),
|
|
||||||
FsEntry::File(p, _) => p
|
|
||||||
.strip_prefix(ROOT)
|
|
||||||
.map(|p| p.to_path_buf())
|
|
||||||
.unwrap_or_else(|_| p.clone()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_full_pathbuf(&self) -> PathBuf {
|
pub fn get_full_pathbuf(&self) -> PathBuf {
|
||||||
match self {
|
match self {
|
||||||
FsEntry::Dir(p) => p.clone(),
|
FsEntry::Dir(p) => p.clone(),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ mod search_view;
|
||||||
mod shared;
|
mod shared;
|
||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
use crate::file_list_view::FsEntry;
|
|
||||||
use shared::{render_current_path, render_instruction_line, render_search_term};
|
use shared::{render_current_path, render_instruction_line, render_search_term};
|
||||||
use state::{refresh_directory, State};
|
use state::{refresh_directory, State};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
@ -58,7 +57,7 @@ impl ZellijPlugin for State {
|
||||||
self.update_files(paths);
|
self.update_files(paths);
|
||||||
should_render = true;
|
should_render = true;
|
||||||
},
|
},
|
||||||
Event::HostFolderChanged(new_host_folder) => {
|
Event::HostFolderChanged(_new_host_folder) => {
|
||||||
scan_host_folder(&"/host");
|
scan_host_folder(&"/host");
|
||||||
should_render = true;
|
should_render = true;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ use std::{
|
||||||
};
|
};
|
||||||
use zellij_tile::prelude::*;
|
use zellij_tile::prelude::*;
|
||||||
|
|
||||||
pub const ROOT: &str = "/host";
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
pub file_list_view: FileListView,
|
pub file_list_view: FileListView,
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,11 @@ pub(crate) enum ClientInstruction {
|
||||||
UnblockCliPipeInput(()), // String -> pipe name
|
UnblockCliPipeInput(()), // String -> pipe name
|
||||||
CliPipeOutput((), ()), // String -> pipe name, String -> output
|
CliPipeOutput((), ()), // String -> pipe name, String -> output
|
||||||
QueryTerminalSize,
|
QueryTerminalSize,
|
||||||
WriteConfigToDisk { config: String },
|
WriteConfigToDisk {
|
||||||
|
config: String,
|
||||||
|
},
|
||||||
StartWebServer,
|
StartWebServer,
|
||||||
|
#[allow(dead_code)] // we need the session name here even though we're not currently using it
|
||||||
RenamedSession(String), // String -> new session name
|
RenamedSession(String), // String -> new session name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ pub fn start_web_client(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
async fn listen_to_config_file_changes(config_file_path: PathBuf, instance_id: &str) {
|
async fn listen_to_config_file_changes(config_file_path: PathBuf, instance_id: &str) {
|
||||||
let socket_path = WEBSERVER_SOCKET_PATH.join(instance_id);
|
let socket_path = WEBSERVER_SOCKET_PATH.join(instance_id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use super::sixel::{PixelRect, SixelGrid, SixelImageStore};
|
use super::sixel::{PixelRect, SixelGrid, SixelImageStore};
|
||||||
use regex::Regex;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
|
||||||
|
|
@ -1313,8 +1313,6 @@ impl Tab {
|
||||||
pid,
|
pid,
|
||||||
initial_pane_title,
|
initial_pane_title,
|
||||||
invoked_with,
|
invoked_with,
|
||||||
start_suppressed,
|
|
||||||
should_focus_pane,
|
|
||||||
pane_id_to_replace,
|
pane_id_to_replace,
|
||||||
close_replaced_pane,
|
close_replaced_pane,
|
||||||
client_id,
|
client_id,
|
||||||
|
|
@ -1615,8 +1613,6 @@ impl Tab {
|
||||||
pid: PaneId,
|
pid: PaneId,
|
||||||
initial_pane_title: Option<String>,
|
initial_pane_title: Option<String>,
|
||||||
invoked_with: Option<Run>,
|
invoked_with: Option<Run>,
|
||||||
start_suppressed: bool,
|
|
||||||
should_focus_pane: bool,
|
|
||||||
pane_id_to_replace: Option<PaneId>,
|
pane_id_to_replace: Option<PaneId>,
|
||||||
close_replaced_pane: bool,
|
close_replaced_pane: bool,
|
||||||
client_id: Option<ClientId>,
|
client_id: Option<ClientId>,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
use crate::consts::ASSET_MAP;
|
use crate::consts::ASSET_MAP;
|
||||||
use crate::input::theme::Themes;
|
use crate::input::theme::Themes;
|
||||||
|
#[allow(unused_imports)]
|
||||||
use crate::{
|
use crate::{
|
||||||
cli::{CliArgs, Command, SessionCommand, Sessions},
|
cli::{CliArgs, Command, SessionCommand, Sessions},
|
||||||
consts::{
|
consts::{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue