summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-12-06 16:52:29 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-12-06 16:52:29 -0500
commitbf9c102a4cfb85a9fd910195e6372dcd1d062c16 (patch)
treee5e2e15234134b303e90ac52c2bf6f060ec10427
parentf18776324dbd78ebc83b748148e63827a8eddb37 (diff)
version bump and code cleanup0.8.5
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml4
-rw-r--r--src/commands/parent_cursor_move.rs3
-rw-r--r--src/commands/show_hidden.rs1
-rw-r--r--src/config/theme.rs78
-rw-r--r--src/ui/widgets/tui_menu.rs1
6 files changed, 43 insertions, 46 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e64b0c8..702377a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -172,7 +172,7 @@ dependencies = [
[[package]]
name = "joshuto"
-version = "0.8.4"
+version = "0.8.5"
dependencies = [
"alphanumeric-sort",
"chrono",
diff --git a/Cargo.toml b/Cargo.toml
index 8e7c2eb..1159b24 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "joshuto"
-version = "0.8.4"
+version = "0.8.5"
authors = ["Jiayi Zhao <jeff.no.zhao@gmail.com>"]
description = "Terminal file manager inspired by ranger"
homepage = "https://github.com/kamiyaa/joshuto"
@@ -28,7 +28,7 @@ unicode-width = "^0"
users = "^0"
whoami = "^0"
xdg = "^2"
-phf = { version = "0.8", features = ["macros"] }
+phf = { version = "^0", features = ["macros"] }
# fs_extra = "*"
# lazy_static = "*"
diff --git a/src/commands/parent_cursor_move.rs b/src/commands/parent_cursor_move.rs
index 8234753..87f6d11 100644
--- a/src/commands/parent_cursor_move.rs
+++ b/src/commands/parent_cursor_move.rs
@@ -1,7 +1,6 @@
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
-use crate::ui::TuiBackend;
use std::path::PathBuf;
pub fn parent_cursor_move(new_index: usize, context: &mut JoshutoContext) -> JoshutoResult<()> {
@@ -9,7 +8,7 @@ pub fn parent_cursor_move(new_index: usize, context: &mut JoshutoContext) -> Jos
let mut new_index = new_index;
{
- let mut curr_tab = context.tab_context_mut().curr_tab_mut();
+ let curr_tab = context.tab_context_mut().curr_tab_mut();
if let Some(curr_list) = curr_tab.parent_list_mut() {
if curr_list.index.is_some() {
let dir_len = curr_list.contents.len();
diff --git a/src/commands/show_hidden.rs b/src/commands/show_hidden.rs
index 2c381f9..aabc000 100644
--- a/src/commands/show_hidden.rs
+++ b/src/commands/show_hidden.rs
@@ -1,7 +1,6 @@
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
-use crate::ui::TuiBackend;
use super::reload;
diff --git a/src/config/theme.rs b/src/config/theme.rs
index fe88a5d..0ee57af 100644
--- a/src/config/theme.rs
+++ b/src/config/theme.rs
@@ -104,6 +104,45 @@ impl std::default::Default for JoshutoStyleThemeRaw {
}
}
+#[derive(Clone, Debug)]
+pub struct JoshutoStyleTheme {
+ pub fg: Color,
+ pub bg: Color,
+ pub modifier: Modifier,
+ pub prefix: Option<JoshutoPrefix>,
+}
+
+impl JoshutoStyleTheme {
+ pub fn set_bg(mut self, bg: Color) -> Self {
+ self.bg = bg;
+ self
+ }
+ pub fn set_fg(mut self, fg: Color) -> Self {
+ self.fg = fg;
+ self
+ }
+ pub fn set_prefix(mut self, prefix: JoshutoPrefix) -> Self {
+ self.prefix = Some(prefix);
+ self
+ }
+
+ pub fn insert(mut self, modifier: Modifier) -> Self {
+ self.modifier.insert(modifier);
+ self
+ }
+}
+
+impl std::default::Default for JoshutoStyleTheme {
+ fn default() -> Self {
+ Self {
+ fg: default_color(),
+ bg: default_color(),
+ modifier: Modifier::empty(),
+ prefix: None,
+ }
+ }
+}
+
#[derive(Clone, Debug, Deserialize)]
pub struct JoshutoRawTheme {
#[serde(default)]
@@ -166,45 +205,6 @@ impl Flattenable<JoshutoTheme> for JoshutoRawTheme {
}
#[derive(Clone, Debug)]
-pub struct JoshutoStyleTheme {
- pub fg: Color,
- pub bg: Color,
- pub modifier: Modifier,
- pub prefix: Option<JoshutoPrefix>,
-}
-
-impl JoshutoStyleTheme {
- pub fn set_bg(mut self, bg: Color) -> Self {
- self.bg = bg;
- self
- }
- pub fn set_fg(mut self, fg: Color) -> Self {
- self.fg = fg;
- self
- }
- pub fn set_prefix(mut self, prefix: JoshutoPrefix) -> Self {
- self.prefix = Some(prefix);
- self
- }
-
- pub fn insert(mut self, modifier: Modifier) -> Self {
- self.modifier.insert(modifier);
- self
- }
-}
-
-impl std::default::Default for JoshutoStyleTheme {
- fn default() -> Self {
- Self {
- fg: default_color(),
- bg: default_color(),
- modifier: Modifier::empty(),
- prefix: None,
- }
- }
-}
-
-#[derive(Clone, Debug)]
pub struct JoshutoTheme {
pub regular: JoshutoStyleTheme,
pub selection: JoshutoStyleTheme,
diff --git a/src/ui/widgets/tui_menu.rs b/src/ui/widgets/tui_menu.rs
index fdc9320..80a3d3a 100644
--- a/src/ui/widgets/tui_menu.rs
+++ b/src/ui/widgets/tui_menu.rs
@@ -5,7 +5,6 @@ use tui::buffer::Buffer;
use tui::layout::Rect;
use tui::style::{Color, Style};
use tui::widgets::{Block, Borders, Clear, Widget};
-use unicode_width::UnicodeWidthStr;
use super::TuiView;
use crate::commands::{CommandKeybind, KeyCommand};