Jürgen Spitzmüller wrote: > So my question is, should we > > * limit the change to the hunspell checker only, which means that we set up > an extra isWordSeparator function (or an option) for the spellchecker? > > * treat hard hyphens not as word separators in general, i.e. ditch the > canHandleSplitMorphemes() part of the patch? > > To me, the second option makes more sense, but of course this the more > intrusive change.
I propose the attached patch (this is the second option). Jürgen
Index: src/Paragraph.cpp =================================================================== --- src/Paragraph.cpp (Revision 37901) +++ src/Paragraph.cpp (Arbeitskopie) @@ -2843,11 +2843,26 @@ bool Paragraph::isWordSeparator(pos_type pos) const { - if (Inset const * inset = getInset(pos)) + if (Inset const * inset = getInset(pos)) { + // pass nobreakdashes to the spell checker + InsetSpecialChar const * isc = + dynamic_cast<const InsetSpecialChar*>(inset); + if (isc != 0 + && (isc->kind() == InsetSpecialChar::NOBREAKDASH)) + return false; return !inset->isLetter(); + } if (pos == size()) return true; char_type const c = d->text_[pos]; + // if we have a hard hyphen (no en- or emdash), + // we pass this to the spell checker + if (c == '-') { + int j = pos + 1; + if ((j == size() || d->text_[j] != '-') + && (pos == 0 || d->text_[pos - 1] != '-')) + return false; + } // We want to pass the ' and escape chars to the spellchecker static docstring const quote = from_utf8(lyxrc.spellchecker_esc_chars + '\''); return (!isLetterChar(c) && !isDigitASCII(c) && !contains(quote, c));