From 748da3ae72633d44bff6cb05d28e32f98e99693d Mon Sep 17 00:00:00 2001 From: graelo Date: Fri, 19 Mar 2021 23:07:08 +0100 Subject: [PATCH] refactor: colors.rs -> ui/colors.rs --- src/lib.rs | 15 +++++++-------- src/{ => ui}/colors.rs | 0 src/ui/mod.rs | 2 ++ src/ui/vc.rs | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) rename src/{ => ui}/colors.rs (100%) diff --git a/src/lib.rs b/src/lib.rs index d1ceb77..a63641d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,6 @@ use std::path; use std::str::FromStr; pub mod alphabets; -pub mod colors; pub mod error; pub mod model; pub mod output_destination; @@ -98,7 +97,7 @@ pub struct CliOpt { unique_hint: bool, #[clap(flatten)] - colors: colors::UiColors, + colors: ui::colors::UiColors, /// Align hint with its match. #[clap(long, arg_enum, default_value = "leading")] @@ -187,12 +186,12 @@ impl CliOpt { self.unique_hint = value.parse::()?; } - "@copyrat-match-fg" => self.colors.match_fg = colors::parse_color(value)?, - "@copyrat-match-bg" => self.colors.match_bg = colors::parse_color(value)?, - "@copyrat-focused-fg" => self.colors.focused_fg = colors::parse_color(value)?, - "@copyrat-focused-bg" => self.colors.focused_bg = colors::parse_color(value)?, - "@copyrat-hint-fg" => self.colors.hint_fg = colors::parse_color(value)?, - "@copyrat-hint-bg" => self.colors.hint_bg = colors::parse_color(value)?, + "@copyrat-match-fg" => self.colors.match_fg = ui::colors::parse_color(value)?, + "@copyrat-match-bg" => self.colors.match_bg = ui::colors::parse_color(value)?, + "@copyrat-focused-fg" => self.colors.focused_fg = ui::colors::parse_color(value)?, + "@copyrat-focused-bg" => self.colors.focused_bg = ui::colors::parse_color(value)?, + "@copyrat-hint-fg" => self.colors.hint_fg = ui::colors::parse_color(value)?, + "@copyrat-hint-bg" => self.colors.hint_bg = ui::colors::parse_color(value)?, "@copyrat-hint-alignment" => { self.hint_alignment = ui::HintAlignment::from_str(&value)? diff --git a/src/colors.rs b/src/ui/colors.rs similarity index 100% rename from src/colors.rs rename to src/ui/colors.rs diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 8501623..b740123 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -17,6 +17,8 @@ //! - toggle the output destination (tmux buffer or clipboard) //! +pub mod colors; mod vc; + pub use vc::ViewController; pub use vc::{HintAlignment, HintStyle}; diff --git a/src/ui/vc.rs b/src/ui/vc.rs index e3dcff6..220d0e2 100644 --- a/src/ui/vc.rs +++ b/src/ui/vc.rs @@ -7,8 +7,9 @@ use clap::Clap; use sequence_trie::SequenceTrie; use termion::{self, color, cursor, event, style}; +use super::colors::UiColors; use crate::error::ParseError; -use crate::{colors::UiColors, model, output_destination::OutputDestination, selection::Selection}; +use crate::{model, output_destination::OutputDestination, selection::Selection}; pub struct ViewController<'a> { model: &'a mut model::Model<'a>,