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