Treat curly apostrophe as ASCII in spell check

Found while testing crates/engine/src/spell.rs:693 (paragraph_words) and :353 (Dictionary::check)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-10-24 19:24:20 +00:00
co-authored by Claude Haiku 5.5
parent 38d2ade2b7
commit 8145cc1bac
+10
View File
@@ -357,6 +357,9 @@ impl Dictionary {
/// Is `word` spelt correctly? Capitalised and upper-case forms of a lower-case word pass.
pub fn check(&self, word: &str) -> bool {
if word.contains('\u{2019}') {
return self.check(&word.replace('\u{2019}', "'"));
}
if word.is_empty() || word.chars().all(|c| !c.is_alphabetic()) {
return true;
}
@@ -800,6 +803,13 @@ SFX D Y 1\nSFX D 0 ed/S .\n";
Dictionary::parse(AFF.as_bytes(), DIC.as_bytes())
}
#[test]
fn curly_apostrophe_matches_ascii_entry() {
let d = Dictionary::parse(AFF.as_bytes(), "2\ndon't\nwork\n".as_bytes());
assert!(d.check("don't"));
assert!(d.check("don\u{2019}t"));
}
#[test]
fn roots_affixes_and_cross_products_check() {
let d = d();