diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-04-25 13:51:30 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-04-25 13:51:30 -0400 |
commit | a0fd0d5ec9cc023674099be44a2feea08879b0e9 (patch) | |
tree | 019fabc1e4a0ed9b84291d82b1919284219e01e0 /src/context | |
parent | ea0ea2f394f27ab7eb92d62bf54c64fd8ab32752 (diff) |
add glob support to search
Diffstat (limited to 'src/context')
-rw-r--r-- | src/context/context.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/context/context.rs b/src/context/context.rs index 5e5bb0e..14e262f 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -3,6 +3,8 @@ use std::collections::VecDeque; use std::sync::mpsc; use std::thread; +use globset::GlobMatcher; + use crate::config; use crate::context::{LocalStateContext, TabContext}; use crate::io::{IoWorkerObserver, IoWorkerProgress, IoWorkerThread}; @@ -14,7 +16,7 @@ pub struct JoshutoContext { events: Events, tab_context: TabContext, local_state: Option<LocalStateContext>, - search_state: Option<String>, + search_state: Option<GlobMatcher>, message_queue: VecDeque<String>, worker_queue: VecDeque<IoWorkerThread>, worker: Option<IoWorkerObserver>, @@ -79,11 +81,11 @@ impl JoshutoContext { self.local_state.take() } - pub fn set_search_state(&mut self, pattern: String) { + pub fn set_search_state(&mut self, pattern: GlobMatcher) { self.search_state = Some(pattern); } - pub fn get_search_state(&self) -> Option<&String> { + pub fn get_search_state(&self) -> Option<&GlobMatcher> { self.search_state.as_ref() } |