]> git.lyx.org Git - lyx.git/blobdiff - src/Thesaurus.cpp
Do not let cursor overlap with inserted graphics.
[lyx.git] / src / Thesaurus.cpp
index 4f4ad64d14aba691df74e59eb45445e20e76f261..1c1adc03b0e22cb91154ac21e396957b05997bb3 100644 (file)
 #include "support/FileNameList.h"
 #include "support/Package.h"
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/docstring_list.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 
-#ifdef USE_EXTERNAL_MYTHES
-#include MYTHES_H_LOCATION
-#else
 #include <cstdio>
-#include "support/mythes/mythes.hxx"
-#endif
-
-#include "frontends/alert.h"
+#include MYTHES_H_LOCATION
 
 #include <algorithm>
 #include <cstring>
@@ -50,7 +44,7 @@ namespace {
 
 typedef std::map<docstring, MyThes *> Thesauri;
 
-} // namespace anon
+} // namespace
 
 struct Thesaurus::Private
 {
@@ -220,10 +214,10 @@ bool Thesaurus::thesaurusInstalled(docstring const & lang) const
 Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
 {
        Meanings meanings;
-       MyThes * mythes = 0;
+       MyThes * mythes = nullptr;
 
        docstring const lang_code = from_ascii(wl.lang()->code());
-       docstring const t = wl.word();
+       docstring const t = wl.word();
 
        if (!d->addThesaurus(lang_code))
                return meanings;
@@ -240,7 +234,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
                return meanings;
 
        string const encoding = mythes->get_th_encoding();
-       
+
        mentry * pmean;
        string const text = to_iconv_encoding(support::lowercase(t), encoding);
        int len = strlen(text.c_str());
@@ -272,6 +266,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
                // remove silly item
                if (support::prefixIs(meaning, '-'))
                        meaning = support::ltrim(meaning, "- ");
+               ret.reserve(pm->count);
                for (int j = 0; j < pm->count; j++) {
                        ret.push_back(from_iconv_encoding(string(pm->psyns[j]), encoding));
                }