A bit hacky, though.
Would be more straightforward if PosIterator had a vector instead of a stack
as internal container, so I could have a InsetOld * PosIterator::inset()
method.
Comments?
Alfredo
Index: frontends/controllers/ControlSpellchecker.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlSpellchecker.C,v
retrieving revision 1.58
diff -u -p -u -r1.58 ControlSpellchecker.C
--- frontends/controllers/ControlSpellchecker.C 4 Nov 2003 10:30:36 -0000 1.58
+++ frontends/controllers/ControlSpellchecker.C 6 Nov 2003 21:42:08 -0000
@@ -161,7 +161,17 @@ WordLangTuple nextWord(PosIterator & cur
int & progress, BufferParams & bp)
{
// skip until we have real text (will jump paragraphs)
- for (; cur != end && !isLetter(cur); ++cur, ++progress);
+ for (; cur != end && !isLetter(cur); ++cur, ++progress) {
+ if (!cur.at_end()) {
+ //skip a whole inset that does not allow spellcheck
+ InsetOld * inset = cur.pit()->getInset(cur.pos());
+ if (inset && !inset->allowSpellCheck()) {
+ ParagraphList::iterator pit = cur.pit();
+ for (++cur, ++progress; cur.pit() != pit
+ ; ++cur, ++progress);
+ }
+ }
+ }
if (cur == end)
return WordLangTuple(string(), string());
@@ -174,7 +184,6 @@ WordLangTuple nextWord(PosIterator & cur
if (!cur.pit()->isInset(cur.pos()))
str += cur.pit()->getChar(cur.pos());
}
-
return WordLangTuple(str, lang_code);
}
@@ -201,7 +210,6 @@ void ControlSpellchecker::check()
if (cur != buffer()->pos_iterator_begin())
for (; cur != end && isLetter(cur); ++cur, ++start);
-
while (res == SpellBase::OK || res == SpellBase::IGNORE) {
word_ = nextWord(cur, end, start, buffer()->params());
Index: insets/inset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v
retrieving revision 1.135
diff -u -p -u -r1.135 inset.h
--- insets/inset.h 5 Nov 2003 12:06:06 -0000 1.135
+++ insets/inset.h 6 Nov 2003 21:42:10 -0000
@@ -284,6 +284,9 @@ public:
/// mark the inset contents as erased (for change tracking)
virtual void markErased() {}
+ /// does this inset allows spellchecking?
+ virtual bool allowSpellCheck() const { return true; }
+
/** Adds a LaTeX snippet to the Preview Loader for transformation
* into a bitmap image. Does not start the laoding process.
*
Index: insets/insetert.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v
retrieving revision 1.92
diff -u -p -u -r1.92 insetert.h
--- insets/insetert.h 5 Nov 2003 12:06:07 -0000 1.92
+++ insets/insetert.h 6 Nov 2003 21:42:10 -0000
@@ -133,6 +133,8 @@ private:
void updateStatus(BufferView *, bool = false) const;
///
void edit(BufferView * bv, bool left);
+ ///
+ bool allowSpellCheck() const { return false; }
///
mutable ERTStatus status_;