Skip to content

Commit

Permalink
version bump and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiyaa committed Dec 6, 2020
1 parent f187763 commit bf9c102
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 = "*"
Expand Down
3 changes: 1 addition & 2 deletions src/commands/parent_cursor_move.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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<()> {
let mut path: Option<PathBuf> = None;
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();
Expand Down
1 change: 0 additions & 1 deletion src/commands/show_hidden.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
use crate::ui::TuiBackend;

use super::reload;

Expand Down
78 changes: 39 additions & 39 deletions src/config/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -165,45 +204,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,
Expand Down
1 change: 0 additions & 1 deletion src/ui/widgets/tui_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit bf9c102

Please sign in to comment.