Re: A possible patch. Opinions solicited.
On 21-Sep-2001 Jean-Marc Lasgouttes wrote: Angus It's a one-line fix, but I don't know if it's the right fix. Angus Perhaps someone with some knowledge of this part of the code Angus would cast their beady eyes over it. I think it is good enough. Anyway selectNextWord is only used by No IMO this should be solved in the ERT-Inset, by overriding the functions for selectNextWord, otherwise we soon will have a big switch there with all the exeption, which should be handled by the insets themselfs (as they know what they like and what not! spellchecker. It should maybe be renamed to something else, like selectNextWordToSpellCheck... Yes, this should be done! Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ You can observe a lot just by watching. -- Yogi Berra
Re: A possible patch. Opinions solicited.
On Monday 24 September 2001 10:21, Jean-Marc Lasgouttes wrote: Juergen == Juergen Vigna [EMAIL PROTECTED] writes: Juergen No IMO this should be solved in the ERT-Inset, by overriding Juergen the functions for selectNextWord, otherwise we soon will have Juergen a big switch there with all the exeption, which should be Juergen handled by the insets themselfs (as they know what they like Juergen and what not! Yes, it would indeed be a better solution. I overlooked that. Angus, could you try to have a look at that? I have done so and am now stuck! InsetERT::selectNextWordToSpellcheck now returns string(). The controlling LyXText::selectNextWordToSpellcheck routine, however contains: // Now, skip until we have real text (will jump paragraphs) while ((cursor.par()-size() cursor.pos() (!cursor.par()-isLetter(cursor.pos())) (!cursor.par()-isInset(cursor.pos()) || !cursor.par()-getInset(cursor.pos())-isTextInset())) || (cursor.par()-size() == cursor.pos() cursor.par()-next())) { if (cursor.pos() == cursor.par()-size()) { cursor.par(cursor.par()-next()); cursor.pos(0); } else cursor.pos(cursor.pos() + 1); } Ie, set the cursor position to be the first word of the Inset Followed by: // 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())) { // lock the inset! cursor.par()-getInset(cursor.pos())-edit(bview); // now call us again to do the above trick // but obviously we have to start from down below ;) return bview-text-selectNextWordToSpellcheck(bview, value); } Ie, the first incorrect word AFTER the inset. Change it, and you change the first word in the inset that you don't want to change!!! So, I still can't see how we can avoid the modification to the controlling while statement. Angus
Re: A possible patch. Opinions solicited.
On 24-Sep-2001 Angus Leeming wrote: InsetERT::selectNextWordToSpellcheck now returns string(). Well does it unlock itself? The function should look like: string const InsetERT::selectNextWordToSpellcheck(BufferView * bv, float ) const { bv-unlockInset(const_castInsetERT *(this)); return string(); } Does this help? Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Better living a beggar than buried an emperor.
Re: A possible patch. Opinions solicited.
On Monday 24 September 2001 15:05, Juergen Vigna wrote: On 24-Sep-2001 Angus Leeming wrote: InsetERT::selectNextWordToSpellcheck now returns string(). Well does it unlock itself? No it didn't. The function should look like: string const InsetERT::selectNextWordToSpellcheck(BufferView * bv, float ) const { bv-unlockInset(const_castInsetERT *(this)); return string(); } Does this help? Yes it does! All works correctly, so I've committed it. Angus
Re: A possible patch. Opinions solicited.
On 24-Sep-2001 Angus Leeming wrote: Does this help? Yes it does! All works correctly, so I've committed it. Good! :) Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ What happened last night can happen again.
Re: A possible patch. Opinions solicited.
On 21-Sep-2001 Jean-Marc Lasgouttes wrote: > Angus> It's a one-line fix, but I don't know if it's the "right" fix. > Angus> Perhaps someone with some knowledge of this part of the code > Angus> would cast their beady eyes over it. > > I think it is good enough. Anyway selectNextWord is only used by No IMO this should be solved in the ERT-Inset, by overriding the functions for selectNextWord, otherwise we soon will have a big switch there with all the exeption, which should be handled by the insets themselfs (as they know what they like and what not! > spellchecker. It should maybe be renamed to something else, like > selectNextWordToSpellCheck... Yes, this should be done! Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ You can observe a lot just by watching. -- Yogi Berra
Re: A possible patch. Opinions solicited.
On Monday 24 September 2001 10:21, Jean-Marc Lasgouttes wrote: > > "Juergen" == Juergen Vigna <[EMAIL PROTECTED]> writes: > > Juergen> No IMO this should be solved in the ERT-Inset, by overriding > Juergen> the functions for selectNextWord, otherwise we soon will have > Juergen> a big switch there with all the exeption, which should be > Juergen> handled by the insets themselfs (as they know what they like > Juergen> and what not! > > Yes, it would indeed be a better solution. I overlooked that. Angus, > could you try to have a look at that? I have done so and am now stuck! InsetERT::selectNextWordToSpellcheck now returns string(). The controlling LyXText::selectNextWordToSpellcheck routine, however contains: // Now, skip until we have real text (will jump paragraphs) while ((cursor.par()->size() > cursor.pos() && (!cursor.par()->isLetter(cursor.pos())) && (!cursor.par()->isInset(cursor.pos()) || !cursor.par()->getInset(cursor.pos())->isTextInset())) || (cursor.par()->size() == cursor.pos() && cursor.par()->next())) { if (cursor.pos() == cursor.par()->size()) { cursor.par(cursor.par()->next()); cursor.pos(0); } else cursor.pos(cursor.pos() + 1); } Ie, set the cursor position to be the first word of the Inset Followed by: // 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())) { // lock the inset! cursor.par()->getInset(cursor.pos())->edit(bview); // now call us again to do the above trick // but obviously we have to start from down below ;) return bview->text->selectNextWordToSpellcheck(bview, value); } Ie, the first incorrect word AFTER the inset. Change it, and you change the first word in the inset that you don't want to change!!! So, I still can't see how we can avoid the modification to the controlling while statement. Angus
Re: A possible patch. Opinions solicited.
On 24-Sep-2001 Angus Leeming wrote: > InsetERT::selectNextWordToSpellcheck now returns string(). Well does it unlock itself? The function should look like: string const InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const { bv->unlockInset(const_cast(this)); return string(); } Does this help? Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Better living a beggar than buried an emperor.
Re: A possible patch. Opinions solicited.
On Monday 24 September 2001 15:05, Juergen Vigna wrote: > On 24-Sep-2001 Angus Leeming wrote: > > > InsetERT::selectNextWordToSpellcheck now returns string(). > > Well does it unlock itself? No it didn't. > The function should look like: > > string const InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const > { > bv->unlockInset(const_cast(this)); > return string(); > } > > Does this help? Yes it does! All works correctly, so I've committed it. Angus
Re: A possible patch. Opinions solicited.
On 24-Sep-2001 Angus Leeming wrote: >> Does this help? > > Yes it does! All works correctly, so I've committed it. Good! :) Jürgen -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen VignaE-Mail: [EMAIL PROTECTED] Italienallee 13/N Tel/Fax: +39-0471-450260 / +39-0471-450253 I-39100 Bozen Web: http://www.sad.it/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ What happened last night can happen again.
A possible patch. Opinions solicited.
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);
Re: A possible patch. Opinions solicited.
On Friday 21 September 2001 15:41, Jean-Marc Lasgouttes wrote: Angus == Angus Leeming [EMAIL PROTECTED] writes: Angus From Michael's bug list: - The spellchecker should ignore ERTs Angus The patch attached achieves this by modifying Angus LyXText::selectNextWord. A word is not selected if it is inside Angus an ERT inset. Angus It's a one-line fix, but I don't know if it's the right fix. Angus Perhaps someone with some knowledge of this part of the code Angus would cast their beady eyes over it. I think it is good enough. Anyway selectNextWord is only used by spellchecker. It should maybe be renamed to something else, like selectNextWordToSpellCheck... Good. I'll change the function name and commit. A
A possible patch. Opinions solicited.
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 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);
Re: A possible patch. Opinions solicited.
On Friday 21 September 2001 15:41, Jean-Marc Lasgouttes wrote: > > "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> From Michael's bug list: - The spellchecker should ignore ERTs > > Angus> The patch attached achieves this by modifying > Angus> LyXText::selectNextWord. A word is not selected if it is inside > Angus> an ERT inset. > > Angus> It's a one-line fix, but I don't know if it's the "right" fix. > Angus> Perhaps someone with some knowledge of this part of the code > Angus> would cast their beady eyes over it. > > I think it is good enough. Anyway selectNextWord is only used by > spellchecker. It should maybe be renamed to something else, like > selectNextWordToSpellCheck... Good. I'll change the function name and commit. A