Am 02.09.2010 um 00:35 schrieb Jean-Marc Lasgouttes:

> Le 01/09/2010 20:11, Stephan Witt a écrit :
>>>> +// Paragraph::SpellRanges +//
>>>> +/////////////////////////////////////////////////////////////////////
>>>> 
>>>> 
> +
>>>> +class Paragraph::SpellCheckerState {
>>> 
>>> What is the real name? Does it need to be in Paragraph, or can it
>>> be in Paragraph::Private? Or can it even be toplevel?
> 
> I meant that the comment and the class name do not match.

The name in comment was from a previous implementation... I overlooked it.

> 
>> It's all about two questions: * does the paragraph need a check of
>> spelling * where are the error locations (ranges)
>> 
>> I thought, Paragraph::SpellCheckerState is private...
> 
> Yes, but there is no need to expose it in Paragraph.h. The class could
> be standalone and a member speller_state_ still in Paragraph::Private.
> This avoid friend declarations.

Ok, that's a better solution. I haven't come up with this idea.

> 
>>> I do not see why you need that. After all, the spellchecking is
>>> done linearly in the paragraph, and thus all you have to do is to
>>> append to the Range object (actually, a list<>  and some push_back
>>> would be enough).
>> 
>> My intention was to shift all positions to left or right on delete or
>> insert of a char/inset. This especially will be useful, when it comes
>> to real "spell check as you type". Then not the whole paragraph needs
>> to be checked again - only the word at the current position. But I'm
>> not there...
> 
> I suspect this is overkill.
> Abdel's solution at row level was good in this respect.
> Do you gain a lot in terms of performance when going at paragraph level?

Yes, for scrolling - see below.

> I fear this is going to become very fragile.

That's why I stopped here and see currently no need to reduce the spell check 
range to 
the current word. 

Regarding the move to paragraph level check...
That simplifies the code and is my solution to get the F7-Spell check and 
scrolling right and fast.
To stay on row level means to rerun the spell check every time the (current) 
row changes.
When typing this is ok. But on scroll you have a complete spell check of the 
visible part again and again.
Now this is gone. I think that speeds up scrolling on all platforms. But I 
didn't profile this.

The point is to catch all possibilities to change paragraph contents. But that 
holds true for
change tracking either. Perhaps a common method can simplify that... But every 
change of content
has to go through Paragraph methods. So it must be doable with little effort.

Stephan

Reply via email to