From Michael's bug list:

- The spellchecker should ignore ERTs

The patch attached achieves this by modifying LyXText::selectNextWord. A word 
is not selected if it is inside an ERT inset.

It's a one-line fix, but I don't know if it's the "right" fix. Perhaps 
someone with some knowledge of this part of the code would cast their beady 
eyes over it.

Many thanks,
Angus
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.335
diff -u -p -r1.335 ChangeLog
--- src/ChangeLog       2001/09/21 12:11:24     1.335
+++ src/ChangeLog       2001/09/21 13:54:26
@@ -1,3 +1,8 @@
+2001-09-21  Angus Leeming  <[EMAIL PROTECTED]>
+
+       * text.C (selectNextWord): do not select words inside an ERT
+       inset.
+
 2001-09-21  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
        * sp_base.h: include <sys/types.h>
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.187
diff -u -p -r1.187 text.C
--- src/text.C  2001/09/09 22:02:13     1.187
+++ src/text.C  2001/09/21 13:54:26
@@ -2306,10 +2306,12 @@ string const LyXText::selectNextWord(Buf
        while ((cursor.par()->size() > cursor.pos()
               && (!cursor.par()->isLetter(cursor.pos()))
               && (!cursor.par()->isInset(cursor.pos()) ||
-                  !cursor.par()->getInset(cursor.pos())->isTextInset()))
+                  !(cursor.par()->getInset(cursor.pos())->isTextInset() &&
+                    cursor.par()->getInset(cursor.pos())->lyxCode() !=
+                    Inset::ERT_CODE)))
               || (cursor.par()->size() == cursor.pos()
                   && cursor.par()->next()))
-       {
+       {      
                if (cursor.pos() == cursor.par()->size()) {
                        cursor.par(cursor.par()->next());
                        cursor.pos(0);
@@ -2319,7 +2321,7 @@ string const LyXText::selectNextWord(Buf
 
        // now check if we hit an inset so it has to be a inset containing text!
        if (cursor.pos() < cursor.par()->size() &&
-               cursor.par()->isInset(cursor.pos()))
+           cursor.par()->isInset(cursor.pos()))
        {
                // lock the inset!
                cursor.par()->getInset(cursor.pos())->edit(bview);

Reply via email to