return false;
docstring word = asString(from, to, AS_STR_INSETS);
+ // Ignore words with digits
+ // FIXME: make this customizable
+ // (note that hunspell ignores words with digits by default)
+ bool const ignored = hasDigit(word);
Language * lang = const_cast<Language *>(getFontSettings(
d->inset_owner_->buffer().params(), from).language());
if (lang == d->inset_owner_->buffer().params().language
lang->setVariety(lang_variety);
}
wl = WordLangTuple(word, lang);
- SpellChecker::Result res = speller->check(wl);
+ SpellChecker::Result res = ignored ?
+ SpellChecker::OK : speller->check(wl);
#if 0
// FIXME: the code below makes aspell abort if a word in an unknown
// language is checked.
}
+bool hasDigit(docstring const & str)
+{
+ if (str.empty())
+ return false;
+
+ // Remove leading and trailing white space chars.
+ docstring const tmpstr = trim(str);
+ if (tmpstr.empty())
+ return false;
+
+ docstring::const_iterator cit = tmpstr.begin();
+ docstring::const_iterator end = tmpstr.end();
+ for (; cit != end; ++cit)
+ if (isdigit((*cit)))
+ return true;
+
+ return false;
+}
+
+
static bool isHexChar(char_type c)
{
return c == '0' ||
///
bool isStrDbl(std::string const & str);
+/// does the string contain a digit?
+bool hasDigit(docstring const & str);
+
bool isHex(docstring const & str);
int hexToInt(docstring const & str);