Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TxModel (Pharo)
Last updated at 5:12 am UTC on 9 November 2017
TxText was an attempt to get a new generation text editor for Pharo. It is in the Pharo 6.0 image, but was removed in Pharo 7 alpha.


TxModel is the central class in Pharo of a domain-based text model.

It is abstract and agnostic from any kind of rendering engine or UI.
It represents an object that contains text and allows certain operation on it, like selection, deletion, insertion.

Rendering engines are the bridge between the model an Morphic and Athens (a SVG rendering engine).


Class comment:

I am the central class, representing the text.

Internally my instances are organized as a double-linked list of spans (TxBasicSpan subclasses). There are multiple kinds of spans, like: CharacterSpan and LineSeparator.

The list is terminated at both ends with special TxStartSpan and TxEndSpan instances (which means even empty text consists of at least two such spans).

Spans carry the actual text content, like characters and attributes.
The model is designed in a way that it should be fairly easy to extend it by introducing new kinds of spans later.

I don't provide a direct interface for mutating/editing my data (and this is a very important point). Instead I am modified using position(s) (TxTextPosition) and/or selection(s) (TxInterval/TxSelection), providing a rich protocol for various operations over text.



Successor: Bloc / Brick (Pharo)