From 8fa96ceec8d00ab538315e4328904e01e7219ce2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 15 Mar 2011 10:46:14 +0000 Subject: [PATCH] Do not hardcode specific insets, but use a variable instead. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37932 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Paragraph.cpp | 5 +---- src/insets/Inset.h | 3 +++ src/insets/InsetSpecialChar.cpp | 6 ++++++ src/insets/InsetSpecialChar.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index d5f4a5869c..f78cefb974 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -3346,10 +3346,7 @@ int Paragraph::find(docstring const & str, bool cs, bool mw, for (i = 0; i < strsize && pos < parsize; ++i, ++pos) { // Ignore ligature break and hyphenation chars while searching while (pos < parsize - 1 && isInset(pos)) { - const InsetSpecialChar *isc = dynamic_cast(getInset(pos)); - if (isc == 0 - || (isc->kind() != InsetSpecialChar::HYPHENATION - && isc->kind() != InsetSpecialChar::LIGATURE_BREAK)) + if (!getInset(pos)->skipOnSearch()) break; pos++; } diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 2683de490a..a35b5e8c90 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -402,6 +402,9 @@ public: /// Is the content of this inset part of the output document? virtual bool producesOutput() const { return true; } + /// Skip this inset while searching? + virtual bool skipOnSearch() const { return false; } + /// \return Tool tip for this inset. /// This default implementation returns an empty string. virtual docstring toolTip(BufferView const & bv, int x, int y) const; diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index 106755076b..6550ac9094 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -346,6 +346,12 @@ bool InsetSpecialChar::isLetter() const } +bool InsetSpecialChar::skipOnSearch() const +{ + return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK; +} + + bool InsetSpecialChar::isLineSeparator() const { #if 0 diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h index 294c9c2659..b96863a732 100644 --- a/src/insets/InsetSpecialChar.h +++ b/src/insets/InsetSpecialChar.h @@ -81,6 +81,8 @@ public: bool isChar() const { return true; } /// is this equivalent to a letter? bool isLetter() const; + /// Skip this inset while searching? + bool skipOnSearch() const; // should we break lines after this inset? bool isLineSeparator() const; private: -- 2.39.2