forked from 1b-agent/opencadstudio-upstream
fix(spellcheck): Linux wordlist flags unknown words; only hunspell counts as CLI
- check_word returned "valid" for a word missing from a loaded wordlist (!words.is_empty() && !contains, with contains already false), so the wordlist backend never flagged anything. - aspell on PATH counted as a CLI speller, but only hunspell is invoked, so on a machine with aspell and no hunspell every CLI check silently failed. - A bare wordlist offers no suggestions; the test no longer demands them from the linux_system backend. Unused PathBuf import dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
60e23a43a6
commit
ab0682153d
2 files changed
+10
-5
No files matched your search
@@ -595,7 +595,7 @@ pub(crate) mod linux_impl {
|
||||
use std::collections::HashSet;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
|
||||
const LINUX_DICT_DIRS: &[&str] = &[
|
||||
"/usr/share/hunspell",
|
||||
@@ -645,7 +645,8 @@ pub(crate) mod linux_impl {
|
||||
}
|
||||
}
|
||||
|
||||
let has_cli = is_command_in_path("hunspell") || is_command_in_path("aspell");
|
||||
// Only hunspell is ever invoked (`check_via_cli`), so only it counts.
|
||||
let has_cli = is_command_in_path("hunspell");
|
||||
|
||||
if !found_any && !has_cli {
|
||||
return None;
|
||||
@@ -683,7 +684,9 @@ pub(crate) mod linux_impl {
|
||||
}
|
||||
}
|
||||
|
||||
(!self.words.is_empty() && !self.words.contains(&clean), Vec::new())
|
||||
// Not in the wordlist and no CLI answer: misspelled when there is
|
||||
// a wordlist to judge by, unjudged (accepted) when there is none.
|
||||
(self.words.is_empty(), Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user