From 5942928b45ba99be0bef8c4ffad7268d6a1ecb61 Mon Sep 17 00:00:00 2001 From: pstatic Date: Sun, 1 Jun 2008 03:44:41 +0000 Subject: [PATCH] fix bug #595, with spell check Originally committed to SVN as r2196. --- aegisub/spellchecker_hunspell.cpp | 3 +++ aegisub/subs_edit_ctrl.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/aegisub/spellchecker_hunspell.cpp b/aegisub/spellchecker_hunspell.cpp index faf354167..90cb88fd9 100644 --- a/aegisub/spellchecker_hunspell.cpp +++ b/aegisub/spellchecker_hunspell.cpp @@ -237,6 +237,7 @@ void HunspellSpellChecker::SetLanguage(wxString language) { if (language.IsEmpty()) return; // Get dir name + //FIXME: this should use ?user instead of ?data; however, since it apparently works already on win32, I'm not gonna mess with it right now :p wxString path = DecodeRelativePath(Options.AsText(_T("Dictionaries path")),StandardPaths::DecodePath(_T("?data/"))) + _T("/"); wxString userPath = StandardPaths::DecodePath(_T("?user/dictionaries/user_")); @@ -245,6 +246,8 @@ void HunspellSpellChecker::SetLanguage(wxString language) { dicpath = path + language + _T(".dic"); usrdicpath = userPath + language + _T(".dic"); + printf("Using dictionary %ls for spellchecking\n", dicpath.c_str()); + // Check if language is available if (!wxFileExists(affpath) || !wxFileExists(dicpath)) return; diff --git a/aegisub/subs_edit_ctrl.cpp b/aegisub/subs_edit_ctrl.cpp index 4bec872bc..6c434056b 100644 --- a/aegisub/subs_edit_ctrl.cpp +++ b/aegisub/subs_edit_ctrl.cpp @@ -691,6 +691,11 @@ void SubsTextEditCtrl::StyleSpellCheck(int start, int len) { SetUnicodeStyling(s,e-s,32); } } + + // It seems like wxStyledTextCtrl wants you to finish styling at the end of the text. + // I don't really understand why, it's not documented anywhere I can find, but this fixes bug #595. + StartUnicodeStyling(text.Length(), 0); + SetUnicodeStyling(text.Length(), 0, 0); }