X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FASpell.cpp;h=0cef57293d15ebdde8266c42b20a91423f01b226;hb=b2475f6625efbaacbd574d5b9a2402b4d20c4047;hp=cafa53b3d6a0ddb9521129173ae4c8402d9fbeff;hpb=f630be890494c849981e4fb52ea4740506e92bed;p=lyx.git diff --git a/src/ASpell.cpp b/src/ASpell.cpp index cafa53b3d6..0cef57293d 100644 --- a/src/ASpell.cpp +++ b/src/ASpell.cpp @@ -11,16 +11,17 @@ #include -#include "debug.h" +#include "support/debug.h" #include #include "ASpell_local.h" +#include "LyXRC.h" #include "WordLangTuple.h" #include -using std::string; +using namespace std; namespace lyx { @@ -65,6 +66,12 @@ void ASpell::addSpeller(string const & lang) // platforms (cygwin, OS X). Therefore we use utf-8, that does // always work. aspell_config_replace(config, "encoding", "utf-8"); + if (lyxrc.isp_accept_compound) + // Consider run-together words as legal compounds + aspell_config_replace(config, "run-together", "true"); + else + // Report run-together words as errors + aspell_config_replace(config, "run-together", "false"); AspellCanHaveError * err = new_aspell_speller(config); if (spell_error_object) delete_aspell_can_have_error(spell_error_object); @@ -99,18 +106,18 @@ ASpell::Result ASpell::check(WordLangTuple const & word) int const word_ok = aspell_speller_check(m, to_utf8(word.word()).c_str(), -1); BOOST_ASSERT(word_ok != -1); - if (word_ok) { - res = OK; - } else { - AspellWordList const * sugs = - aspell_speller_suggest(m, to_utf8(word.word()).c_str(), -1); - BOOST_ASSERT(sugs != 0); - els = aspell_word_list_elements(sugs); - if (aspell_word_list_empty(sugs)) - res = UNKNOWN_WORD; - else - res = SUGGESTED_WORDS; - } + if (word_ok) + return OK; + + AspellWordList const * sugs = + aspell_speller_suggest(m, to_utf8(word.word()).c_str(), -1); + BOOST_ASSERT(sugs != 0); + els = aspell_word_list_elements(sugs); + if (aspell_word_list_empty(sugs)) + res = UNKNOWN_WORD; + else + res = SUGGESTED_WORDS; + return res; } @@ -145,10 +152,9 @@ docstring const ASpell::nextMiss() docstring const ASpell::error() { char const * err = 0; - - if (spell_error_object && aspell_error_number(spell_error_object) != 0) { + + if (spell_error_object && aspell_error_number(spell_error_object) != 0) err = aspell_error_message(spell_error_object); - } // FIXME UNICODE: err is not in UTF8, but probably the locale encoding return (err ? from_utf8(err) : docstring());