aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src
diff options
context:
space:
mode:
Diffstat (limited to 'atuin-client/src')
-rw-r--r--atuin-client/src/database.rs4
-rw-r--r--atuin-client/src/settings.rs15
2 files changed, 7 insertions, 12 deletions
diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs
index bb4d9dfa..fa39f71b 100644
--- a/atuin-client/src/database.rs
+++ b/atuin-client/src/database.rs
@@ -41,7 +41,7 @@ pub fn current_context() -> Context {
}
#[async_trait]
-pub trait Database: Send + Sync {
+pub trait Database: Send + Sync + 'static {
async fn save(&mut self, h: &History) -> Result<()>;
async fn save_bulk(&mut self, h: &[History]) -> Result<()>;
@@ -375,7 +375,7 @@ impl Database for Sqlite {
match search_mode {
SearchMode::Prefix => sql.and_where_like_left("command", query),
SearchMode::FullText => sql.and_where_like_any("command", query),
- SearchMode::Skim | SearchMode::Fuzzy => {
+ _ => {
// don't recompile the regex on successive calls!
lazy_static! {
static ref SPLIT_REGEX: Regex = Regex::new(r" +").unwrap();
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs
index a2d4f8c5..756c4966 100644
--- a/atuin-client/src/settings.rs
+++ b/atuin-client/src/settings.rs
@@ -46,16 +46,11 @@ impl SearchMode {
pub fn next(&self, settings: &Settings) -> Self {
match self {
SearchMode::Prefix => SearchMode::FullText,
- SearchMode::FullText => {
- // if the user is using skim, we go to skim, otherwise fuzzy.
- if settings.search_mode == SearchMode::Skim {
- SearchMode::Skim
- } else {
- SearchMode::Fuzzy
- }
- }
- SearchMode::Fuzzy => SearchMode::Prefix,
- SearchMode::Skim => SearchMode::Prefix,
+ // if the user is using skim, we go to skim
+ SearchMode::FullText if settings.search_mode == SearchMode::Skim => SearchMode::Skim,
+ // otherwise fuzzy.
+ SearchMode::FullText => SearchMode::Fuzzy,
+ SearchMode::Fuzzy | SearchMode::Skim => SearchMode::Prefix,
}
}
}