diff --git a/README.md b/README.md index 9afa5fa..e526674 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ One can also be supplied with `--config`. Copy or refer to './doc/cyme\_example\ See './doc/cyme\_example\_config.json' for an example of how icons can be defined and also the [docs](https://docs.rs/cyme/latest/cyme/icon/enum.Icon.html). The config can exclude the "user"/"colours" keys if one wishes not to define any new icons/colours. -Icons are looked up in an order of User -> Default. For devices: `VidPid` -> `VidPidMsb` -> `Vid` -> `UnknownVendor` -> `get_default_vidpid_icon`, classes: `ClassifierSubProtocol` -> `Classifier` -> `UndefinedClassifier` -> `get_default_classifier_icon`. User supplied colours override all internal; if a key is missing, it will be `None`. +Icons are looked up in an order of User -> Default. For devices: `Name` -> `VidPid` -> `VidPidMsb` -> `Vid` -> `UnknownVendor` -> `get_default_vidpid_icon`, classes: `ClassifierSubProtocol` -> `Classifier` -> `UndefinedClassifier` -> `get_default_classifier_icon`. User supplied colours override all internal; if a key is missing, it will be `None`. #### Icons not Showing/Boxes with Question Marks diff --git a/src/icon.rs b/src/icon.rs index 4ccd518..635baf2 100644 --- a/src/icon.rs +++ b/src/icon.rs @@ -276,7 +276,7 @@ lazy_static! { (Icon::Vid(0x1fc9), "\u{f2db}"), // nxp  (Icon::Vid(0x1050), "\u{f084}"), // yubikey  (Icon::Vid(0x0781), "\u{f129e}"), // sandisk 󱊞 - (Icon::Name(r".*sd\scard\sreader.*".to_string()), "\u{ef61}"), // sd card reader  + (Icon::Name(r".*^[sS][dD]\s[cC]ard\s[rR]eader.*".to_string()), "\u{ef61}"), // sd card reader  (Icon::VidPid((0x18D1, 0x2D05)), "\u{e70e}"), // android dev  (Icon::VidPid((0x18D1, 0xd00d)), "\u{e70e}"), // android  (Icon::VidPid((0x1d50, 0x606f)), "\u{f191d}"), // candlelight_fw gs_can 󱤝 @@ -445,7 +445,7 @@ impl IconTheme { .iter() .find(|(k, _)| { if let Icon::Name(s) = k { - regex::Regex::new(s).map_or(false, |r| r.is_match(&name.to_lowercase())) + regex::Regex::new(s).map_or(false, |r| r.is_match(name)) } else { false } @@ -462,7 +462,7 @@ impl IconTheme { .iter() .find(|(k, _)| { if let Icon::Name(s) = k { - regex::Regex::new(s).map_or(false, |r| r.is_match(&name.to_lowercase())) + regex::Regex::new(s).map_or(false, |r| r.is_match(name)) } else { false } @@ -511,7 +511,7 @@ pub fn example() -> HashMap { ), // serial  (Icon::UndefinedClassifier, "\u{2636}".into()), //☶ ( - Icon::Name(r".*sd\scard\sreader.*".to_string()), + Icon::Name(r".*^[sS][dD]\s[cC]ard\s[rR]eader.*".to_string()), "\u{ef61}".into(), ), // sd card reader  ]) @@ -622,8 +622,11 @@ mod tests { let icon = Icon::from_str(str); assert_eq!(icon.unwrap(), Icon::Name("test".to_string())); - let str = r"name#sd\s+card"; + let str = r"name#.*^[sS][dD]\s[cC]ard\s[rR]eader.*"; let icon = Icon::from_str(str); - assert_eq!(icon.unwrap(), Icon::Name("sd\\s+card".to_string())); + assert_eq!( + icon.unwrap(), + Icon::Name(r".*^[sS][dD]\s[cC]ard\s[rR]eader.*".to_string()) + ); } }