feat(core): wire up word_separator option
This commit is contained in:
parent
3df0df6fc7
commit
581bd199bb
|
@ -26,33 +26,14 @@ use espanso_path::Paths;
|
|||
use espanso_ui::{event::UIEvent, UIRemote};
|
||||
use log::info;
|
||||
|
||||
use crate::{
|
||||
cli::worker::{
|
||||
engine::{
|
||||
dispatch::executor::{
|
||||
use crate::{cli::worker::{engine::{dispatch::executor::{
|
||||
clipboard_injector::ClipboardInjectorAdapter, context_menu::ContextMenuHandlerAdapter,
|
||||
event_injector::EventInjectorAdapter, icon::IconHandlerAdapter,
|
||||
key_injector::KeyInjectorAdapter,
|
||||
},
|
||||
process::middleware::{
|
||||
image_resolve::PathProviderAdapter,
|
||||
match_select::MatchSelectorAdapter,
|
||||
matcher::{
|
||||
convert::MatchConverter,
|
||||
regex::{RegexMatcherAdapter, RegexMatcherAdapterOptions},
|
||||
rolling::RollingMatcherAdapter,
|
||||
},
|
||||
multiplex::MultiplexAdapter,
|
||||
render::{
|
||||
}, process::middleware::{image_resolve::PathProviderAdapter, match_select::MatchSelectorAdapter, matcher::{convert::MatchConverter, regex::{RegexMatcherAdapter, RegexMatcherAdapterOptions}, rolling::{RollingMatcherAdapter, RollingMatcherAdapterOptions}}, multiplex::MultiplexAdapter, render::{
|
||||
extension::{clipboard::ClipboardAdapter, form::FormProviderAdapter},
|
||||
RendererAdapter,
|
||||
},
|
||||
},
|
||||
},
|
||||
match_cache::MatchCache,
|
||||
},
|
||||
engine::event::ExitMode,
|
||||
};
|
||||
}}}, match_cache::MatchCache}, engine::event::ExitMode};
|
||||
|
||||
use super::secure_input::SecureInputEvent;
|
||||
|
||||
|
@ -94,7 +75,9 @@ pub fn initialize_and_spawn(
|
|||
vec![&detect_source, &exit_source, &ui_source, &secure_input_source];
|
||||
let funnel = crate::engine::funnel::default(&sources);
|
||||
|
||||
let rolling_matcher = RollingMatcherAdapter::new(&match_converter.get_rolling_matches());
|
||||
let rolling_matcher = RollingMatcherAdapter::new(&match_converter.get_rolling_matches(), RollingMatcherAdapterOptions {
|
||||
char_word_separators: config_manager.default().word_separators(),
|
||||
});
|
||||
let regex_matcher = RegexMatcherAdapter::new(
|
||||
&match_converter.get_regex_matches(),
|
||||
&RegexMatcherAdapterOptions {
|
||||
|
|
|
@ -28,28 +28,21 @@ use crate::engine::{
|
|||
|
||||
use super::MatcherState;
|
||||
|
||||
pub struct RollingMatcherAdapterOptions {
|
||||
pub char_word_separators: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct RollingMatcherAdapter {
|
||||
matcher: RollingMatcher<i32>,
|
||||
}
|
||||
|
||||
impl RollingMatcherAdapter {
|
||||
pub fn new(matches: &[RollingMatch<i32>]) -> Self {
|
||||
// TODO: load them from config
|
||||
|
||||
pub fn new(matches: &[RollingMatch<i32>], options: RollingMatcherAdapterOptions) -> Self {
|
||||
let matcher = RollingMatcher::new(
|
||||
matches,
|
||||
RollingMatcherOptions {
|
||||
char_word_separators: vec![
|
||||
" ".to_string(),
|
||||
",".to_string(),
|
||||
".".to_string(),
|
||||
"?".to_string(),
|
||||
"!".to_string(),
|
||||
"\r".to_string(),
|
||||
"\n".to_string(),
|
||||
(22u8 as char).to_string(),
|
||||
],
|
||||
key_word_separators: vec![],
|
||||
char_word_separators: options.char_word_separators,
|
||||
key_word_separators: vec![], // TODO?
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user