Luigi PAnzeri wrote:

> The problem is that the meaning of the text is stored into ranges that are
> overlapping, instead I need runs (non overlapping ranges of text) in order
> to present the text. So I have to implement an algorithm that rebuild and
> perhaps cache better the run database. I have never really completed to do
> that, as I stopped to work on it. The work at squeaksource about runs was
> coded in a sprint made at the last ESUG) 

A lot of the features and problems you describe we also encountered and 
(partially) solved in the Sophie text rendering. We are also using 
ranges (called markers in Sophie) which allow to add layers on top of 
the underlying content.
We avoided some of the problems you describe by dealing with edits and 
rendering in a multi stage process.

First the edits manipulate the text structure (a tree of sections and 
text runs) and updating marker ranges in the process. Marker update is 
pretty efficient as it only involves adjusting a few offsets.

Then a display structure/list is generated while applying any style 
transformations added by the markers affecting the text. Overlapping 
markers a split into runs during the compositing process, also a very 
efficient process.

At last the display list is rendered.

Some operations like cursor movement and selections can be handled 
without going through the above steps, simply by overlaying them on the 
display structure.

But, it only took us three years to get there and there is still a lot 
to be improved. On the other hand Sophie text also deals with embedded 
images, links, trigger overlays etc, so it is a fairly complex system 
overall. But imagine being able to embed images, audio or video into 
method source/comments :-) OK, theoretically ParagraphEditor can do that 
to, but you don't want to know ;-)

Michael

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to