From 1423fd68e794583ab83754750130c1cf3a4fbbdb Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Thu, 1 May 2025 21:55:56 +0200 Subject: [PATCH] support case config --- README.md | 3 ++- src/lib/config.rs | 7 ++++++- src/lib/gui.rs | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d782693..bd4f64a 100644 --- a/README.md +++ b/README.md @@ -90,10 +90,11 @@ This library is not available publicly yet as the interface is not stable enough * `line_wrap` is now called `line-wrap` * Wofi has a C-API, that is not and won't be supported, but Worf can be used as a rust library. -### Dropped arguments +### Dropped arguments / config values * `mode`, use show * `dmenu`, use show * `D`, arguments are the same as config in worf, no need to have this flag. +* `dark`, dark setting from theme is used now. ### Dropped configuration options * stylesheet -> use style instead diff --git a/src/lib/config.rs b/src/lib/config.rs index d705faa..855297a 100644 --- a/src/lib/config.rs +++ b/src/lib/config.rs @@ -224,7 +224,7 @@ pub struct Config { matching: Option, #[clap(short = 'i', long = "insensitive")] - insensitive: Option, // todo support this + insensitive: Option, #[clap(short = 'q', long = "parse-search")] parse_search: Option, // todo support this @@ -473,6 +473,11 @@ impl Config { pub fn show(&self) -> Option { self.show.clone() } + + #[must_use] + pub fn insensitive(&self) -> bool { + self.insensitive.unwrap_or(true) + } } fn default_false() -> bool { diff --git a/src/lib/gui.rs b/src/lib/gui.rs index 2ad4edd..d19ff8d 100644 --- a/src/lib/gui.rs +++ b/src/lib/gui.rs @@ -854,7 +854,11 @@ fn set_menu_visibility_for_search( menu_item.visible = true; } } else { - let query = query.to_owned().to_lowercase(); // todo match case sensitive according to conf + let query = if config.insensitive() { + query.to_owned().to_lowercase() + } else { + query.to_owned() + }; for menu_item in items.iter_mut() { let menu_item_search = format!( "{} {}",