From 85f486f2594b446012902c8329615f92cd0d6818 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 18 Mar 2011 09:17:09 +0000 Subject: [PATCH] * InsetSpecialChar.cpp: make NOBREAKDASH isLetter() * Paragraph.cpp (isWord separator): handle composites with hyphens as one word (i.e., "-" is not a word separator). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37946 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Paragraph.cpp | 8 ++++++++ src/insets/InsetSpecialChar.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 7d50462e0b..e8cc2fa162 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2850,6 +2850,14 @@ bool Paragraph::isWordSeparator(pos_type pos) const 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)); diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index 106755076b..1fe6840df5 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -342,7 +342,8 @@ void InsetSpecialChar::validate(LaTeXFeatures & features) const bool InsetSpecialChar::isLetter() const { - return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK; + return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK + || kind_ == NOBREAKDASH; } @@ -353,7 +354,8 @@ bool InsetSpecialChar::isLineSeparator() const // Paragraph::stripLeadingSpaces nukes the characters which // have this property. I leave the code here, since it should // eventually be made to work. (JMarc 20020327) - return kind_ == HYPHENATION || kind_ == MENU_SEPARATOR; + return kind_ == HYPHENATION || kind_ == MENU_SEPARATOR + || kind_ == SLASH; #else return false; #endif -- 2.39.2