Fix disabling the spellchecker

Originally committed to SVN as r6274.
This commit is contained in:
Thomas Goyne 2012-01-11 19:19:21 +00:00
parent db18cea308
commit c8d67ea0ff
2 changed files with 10 additions and 7 deletions

View File

@ -194,7 +194,10 @@ wxArrayString HunspellSpellChecker::GetLanguageList() {
}
void HunspellSpellChecker::SetLanguage(wxString language) {
if (language.empty()) return;
if (language.empty()) {
hunspell.reset();
return;
}
wxString userDicRoot = StandardPaths::DecodePath(lagi_wxString(OPT_GET("Path/Dictionary")->GetString()));
wxString dataDicRoot = StandardPaths::DecodePath("?data/dictionaries");

View File

@ -883,12 +883,13 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) {
void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) {
wxArrayString langs = spellchecker->GetLanguageList();
// Set dictionary
int index = event.GetId() - EDIT_MENU_DIC_LANGS - 1;
if (index >= 0) {
spellchecker->SetLanguage(langs[index]);
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(langs[index]));
}
wxString lang;
if (index >= 0)
lang = langs[index];
spellchecker->SetLanguage(lang);
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(lang));
UpdateStyle();
}
@ -896,7 +897,6 @@ void SubsTextEditCtrl::OnSetDicLanguage(wxCommandEvent &event) {
void SubsTextEditCtrl::OnSetThesLanguage(wxCommandEvent &event) {
wxArrayString langs = thesaurus->GetLanguageList();
// Set language
int index = event.GetId() - EDIT_MENU_THES_LANGS - 1;
wxString lang;
if (index >= 0) lang = langs[index];