From 12eb9eed1aeb4f3045b78dd19ae20d07bfea7de9 Mon Sep 17 00:00:00 2001 From: Jiayi Zhao Date: Tue, 15 Dec 2020 11:48:20 -0500 Subject: add option to not collapse preview - add methods to access config_t - add back home dir path shortening option --- src/context/context.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/context') diff --git a/src/context/context.rs b/src/context/context.rs index 520f77c..95c9d1d 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -10,7 +10,7 @@ use crate::util::event::{Event, Events}; pub struct JoshutoContext { pub exit: bool, - pub config_t: config::JoshutoConfig, + config: config::JoshutoConfig, events: Events, tab_context: TabContext, local_state: Option, @@ -21,7 +21,7 @@ pub struct JoshutoContext { } impl JoshutoContext { - pub fn new(config_t: config::JoshutoConfig) -> Self { + pub fn new(config: config::JoshutoConfig) -> Self { Self { exit: false, events: Events::new(), @@ -31,10 +31,18 @@ impl JoshutoContext { message_queue: VecDeque::with_capacity(4), worker_queue: VecDeque::new(), worker: None, - config_t, + config, } } + pub fn config_ref(&self) -> &config::JoshutoConfig { + &self.config + } + + pub fn config_mut(&mut self) -> &mut config::JoshutoConfig { + &mut self.config + } + pub fn tab_context_ref(&self) -> &TabContext { &self.tab_context } -- cgit v1.2.3