diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config/theme.rs | 46 | ||||
-rw-r--r-- | src/context.rs | 2 | ||||
-rw-r--r-- | src/run.rs | 7 |
3 files changed, 41 insertions, 14 deletions
diff --git a/src/config/theme.rs b/src/config/theme.rs index 9664acb..ddbd882 100644 --- a/src/config/theme.rs +++ b/src/config/theme.rs @@ -168,6 +168,29 @@ pub struct JoshutoStyleTheme { 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_bold(mut self, bold: bool) -> Self { + self.bold = bold; + self + } + pub fn set_underline(mut self, bold: bool) -> Self { + self.bold = bold; + self + } + pub fn set_invert(mut self, bold: bool) -> Self { + self.bold = bold; + self + } +} + impl std::default::Default for JoshutoStyleTheme { fn default() -> Self { JoshutoStyleTheme { @@ -201,12 +224,23 @@ impl ConfigStructure for JoshutoTheme { impl std::default::Default for JoshutoTheme { fn default() -> Self { - let selection = JoshutoStyleTheme::default(); - let executable = JoshutoStyleTheme::default(); - let regular = JoshutoStyleTheme::default(); - let directory = JoshutoStyleTheme::default(); - let link = JoshutoStyleTheme::default(); - let socket = JoshutoStyleTheme::default(); + let selection = JoshutoStyleTheme::default() + .set_fg(Color::LightYellow) + .set_bold(true); + let executable = JoshutoStyleTheme::default() + .set_fg(Color::LightGreen) + .set_bold(true); + let regular = JoshutoStyleTheme::default() + .set_fg(Color::White); + let directory = JoshutoStyleTheme::default() + .set_fg(Color::LightBlue) + .set_bold(true); + let link = JoshutoStyleTheme::default() + .set_fg(Color::LightCyan) + .set_bold(true); + let socket = JoshutoStyleTheme::default() + .set_fg(Color::LightMagenta) + .set_bold(true); let ext = HashMap::new(); JoshutoTheme { diff --git a/src/context.rs b/src/context.rs index 328f9f6..601c1fc 100644 --- a/src/context.rs +++ b/src/context.rs @@ -17,7 +17,6 @@ pub struct JoshutoContext { pub worker_msg: Option<String>, pub message_queue: VecDeque<String>, - pub message_elapse: usize, pub events: Events, pub config_t: config::JoshutoConfig, @@ -33,7 +32,6 @@ impl JoshutoContext { trx: mpsc::sync_channel::<u64>(1), worker_msg: None, message_queue: VecDeque::with_capacity(4), - message_elapse: 0, events: Events::new(), config_t, @@ -71,12 +71,7 @@ pub fn run(config_t: JoshutoConfig, keymap_t: JoshutoCommandMapping) -> std::io: Event::Input(key) => { /* Message handling */ if !context.message_queue.is_empty() { - if context.message_elapse < MESSAGE_VISIBLE_DURATION { - context.message_elapse += 1; - } else { - let _ = context.message_queue.pop_front(); - context.message_elapse = 0; - } + let _ = context.message_queue.pop_front(); } match keymap_t.get(&key) { None => { |