From 6ba1bd94540e8a17fa0d202a21a643e02815356f Mon Sep 17 00:00:00 2001 From: graelo Date: Sat, 20 Mar 2021 19:53:38 +0100 Subject: [PATCH] refactor: HintStyle -> ui/hint_style.rs --- src/ui/hint_style.rs | 15 +++++++++++++++ src/ui/mod.rs | 4 +++- src/ui/vc.rs | 17 +---------------- 3 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 src/ui/hint_style.rs diff --git a/src/ui/hint_style.rs b/src/ui/hint_style.rs new file mode 100644 index 0000000..84cf943 --- /dev/null +++ b/src/ui/hint_style.rs @@ -0,0 +1,15 @@ +/// Describes the style of contrast to be used during rendering of the hint's +/// text. +/// +/// # Note +/// In practice, this is wrapped in an `Option`, so that the hint's text can be rendered with no style. +pub enum HintStyle { + /// The hint's text will be bold (leveraging `termion::style::Bold`). + Bold, + /// The hint's text will be italicized (leveraging `termion::style::Italic`). + Italic, + /// The hint's text will be underlined (leveraging `termion::style::Underline`). + Underline, + /// The hint's text will be surrounded by these chars. + Surround(char, char), +} diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 753c9f9..154cd0e 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -18,9 +18,11 @@ //! pub mod colors; +pub mod hint_style; mod selection; mod vc; +pub use hint_style::HintStyle; pub use selection::Selection; +pub use vc::HintAlignment; pub use vc::ViewController; -pub use vc::{HintAlignment, HintStyle}; diff --git a/src/ui/vc.rs b/src/ui/vc.rs index 0cd0c54..c2ffca9 100644 --- a/src/ui/vc.rs +++ b/src/ui/vc.rs @@ -8,6 +8,7 @@ use sequence_trie::SequenceTrie; use termion::{self, color, cursor, event, style}; use super::colors::UiColors; +use super::HintStyle; use super::Selection; use crate::error::ParseError; use crate::{output_destination::OutputDestination, textbuf}; @@ -629,22 +630,6 @@ impl FromStr for HintAlignment { } } -/// Describes the style of contrast to be used during rendering of the hint's -/// text. -/// -/// # Note -/// In practice, this is wrapped in an `Option`, so that the hint's text can be rendered with no style. -pub enum HintStyle { - /// The hint's text will be bold (leveraging `termion::style::Bold`). - Bold, - /// The hint's text will be italicized (leveraging `termion::style::Italic`). - Italic, - /// The hint's text will be underlined (leveraging `termion::style::Underline`). - Underline, - /// The hint's text will be surrounded by these chars. - Surround(char, char), -} - /// Returned value after the `Ui` has finished listening to events. enum Event { /// Exit with no selected matches,