diff --git a/src/location.rs b/src/location.rs index fe93bd0da..ec0482582 100644 --- a/src/location.rs +++ b/src/location.rs @@ -372,7 +372,12 @@ pub async fn get_range( } fn is_marker(txt: &str) -> bool { - txt.len() == 1 && !txt.starts_with(' ') + let mut chars = txt.chars(); + if let Some(c) = chars.next() { + !c.is_whitespace() && chars.next().is_none() + } else { + false + } } /// Deletes all locations from the database. @@ -777,4 +782,13 @@ mod tests { assert!(locations_ref[0].accuracy.abs() < f64::EPSILON); assert_eq!(locations_ref[0].timestamp, timestamp); } + + #[test] + fn test_is_marker() { + assert!(is_marker("f")); + assert!(!is_marker("foo")); + assert!(is_marker("🏠")); + assert!(!is_marker(" ")); + assert!(!is_marker("\t")); + } }