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